Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-21 15:35:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-21 15:35:49 +0300
commit2e6a02438e997f1024f3ba6c332314f09f01a3b4 (patch)
tree7b9427c972858a2b0950b0328bb500f11294161b /release/scripts/startup
parent28d39473fc65543cbf3adc44964d4a9703d3076a (diff)
move script directories for internal blender scripts.
ui/ --> startup/bl_ui op/ --> startup/bl_operators scripts/startup/ is now the only auto-loading script dir which gives some speedup for blender loading too. ~/.blender/2.56/scripts/startup works for auto-loading scripts too.
Diffstat (limited to 'release/scripts/startup')
-rw-r--r--release/scripts/startup/bl_operators/add_mesh_torus.py138
-rw-r--r--release/scripts/startup/bl_operators/animsys_update.py696
-rw-r--r--release/scripts/startup/bl_operators/fcurve_euler_filter.py78
-rw-r--r--release/scripts/startup/bl_operators/image.py189
-rw-r--r--release/scripts/startup/bl_operators/mesh.py172
-rw-r--r--release/scripts/startup/bl_operators/nla.py170
-rw-r--r--release/scripts/startup/bl_operators/object.py563
-rw-r--r--release/scripts/startup/bl_operators/object_align.py280
-rw-r--r--release/scripts/startup/bl_operators/object_randomize_transform.py147
-rw-r--r--release/scripts/startup/bl_operators/presets.py353
-rw-r--r--release/scripts/startup/bl_operators/screen_play_rendered_anim.py142
-rw-r--r--release/scripts/startup/bl_operators/sequencer.py134
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_follow_active.py250
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_lightmap.py582
-rw-r--r--release/scripts/startup/bl_operators/uvcalc_smart_project.py1141
-rw-r--r--release/scripts/startup/bl_operators/vertexpaint_dirt.py176
-rw-r--r--release/scripts/startup/bl_operators/wm.py848
-rw-r--r--release/scripts/startup/bl_ui/__init__.py120
-rw-r--r--release/scripts/startup/bl_ui/properties_animviz.py96
-rw-r--r--release/scripts/startup/bl_ui/properties_data_armature.py310
-rw-r--r--release/scripts/startup/bl_ui/properties_data_bone.py370
-rw-r--r--release/scripts/startup/bl_ui/properties_data_camera.py136
-rw-r--r--release/scripts/startup/bl_ui/properties_data_curve.py392
-rw-r--r--release/scripts/startup/bl_ui/properties_data_empty.py42
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lamp.py386
-rw-r--r--release/scripts/startup/bl_ui/properties_data_lattice.py82
-rw-r--r--release/scripts/startup/bl_ui/properties_data_mesh.py351
-rw-r--r--release/scripts/startup/bl_ui/properties_data_metaball.py118
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py701
-rw-r--r--release/scripts/startup/bl_ui/properties_game.py498
-rw-r--r--release/scripts/startup/bl_ui/properties_material.py969
-rw-r--r--release/scripts/startup/bl_ui/properties_object.py337
-rw-r--r--release/scripts/startup/bl_ui/properties_object_constraint.py781
-rw-r--r--release/scripts/startup/bl_ui/properties_particle.py1213
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_cloth.py218
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_common.py282
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_field.py218
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_fluid.py281
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_smoke.py203
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_softbody.py263
-rw-r--r--release/scripts/startup/bl_ui/properties_render.py638
-rw-r--r--release/scripts/startup/bl_ui/properties_scene.py303
-rw-r--r--release/scripts/startup/bl_ui/properties_texture.py1030
-rw-r--r--release/scripts/startup/bl_ui/properties_world.py267
-rw-r--r--release/scripts/startup/bl_ui/space_console.py160
-rw-r--r--release/scripts/startup/bl_ui/space_dopesheet.py362
-rw-r--r--release/scripts/startup/bl_ui/space_filebrowser.py74
-rw-r--r--release/scripts/startup/bl_ui/space_graph.py247
-rw-r--r--release/scripts/startup/bl_ui/space_image.py753
-rw-r--r--release/scripts/startup/bl_ui/space_info.py401
-rw-r--r--release/scripts/startup/bl_ui/space_logic.py87
-rw-r--r--release/scripts/startup/bl_ui/space_nla.py191
-rw-r--r--release/scripts/startup/bl_ui/space_node.py193
-rw-r--r--release/scripts/startup/bl_ui/space_outliner.py117
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py801
-rw-r--r--release/scripts/startup/bl_ui/space_text.py299
-rw-r--r--release/scripts/startup/bl_ui/space_time.py198
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py1172
-rw-r--r--release/scripts/startup/bl_ui/space_userpref_keymap.py781
-rw-r--r--release/scripts/startup/bl_ui/space_view3d.py2315
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py1312
-rw-r--r--release/scripts/startup/keyingsets_builtins.py365
62 files changed, 26492 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_operators/add_mesh_torus.py b/release/scripts/startup/bl_operators/add_mesh_torus.py
new file mode 100644
index 00000000000..460330a56a1
--- /dev/null
+++ b/release/scripts/startup/bl_operators/add_mesh_torus.py
@@ -0,0 +1,138 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+import mathutils
+
+
+def add_torus(major_rad, minor_rad, major_seg, minor_seg):
+ from math import cos, sin, pi
+
+ Vector = mathutils.Vector
+ Quaternion = mathutils.Quaternion
+
+ PI_2 = pi * 2.0
+ z_axis = 0.0, 0.0, 1.0
+
+ verts = []
+ faces = []
+ i1 = 0
+ tot_verts = major_seg * minor_seg
+ for major_index in range(major_seg):
+ quat = Quaternion(z_axis, (major_index / major_seg) * PI_2)
+
+ for minor_index in range(minor_seg):
+ angle = 2 * pi * minor_index / minor_seg
+
+ vec = Vector((major_rad + (cos(angle) * minor_rad), 0.0,
+ (sin(angle) * minor_rad))) * quat
+
+ verts.extend(vec[:])
+
+ if minor_index + 1 == minor_seg:
+ i2 = (major_index) * minor_seg
+ i3 = i1 + minor_seg
+ i4 = i2 + minor_seg
+
+ else:
+ i2 = i1 + 1
+ i3 = i1 + minor_seg
+ i4 = i3 + 1
+
+ if i2 >= tot_verts:
+ i2 = i2 - tot_verts
+ if i3 >= tot_verts:
+ i3 = i3 - tot_verts
+ if i4 >= tot_verts:
+ i4 = i4 - tot_verts
+
+ # stupid eekadoodle
+ if i2:
+ faces.extend([i1, i3, i4, i2])
+ else:
+ faces.extend([i2, i1, i3, i4])
+
+ i1 += 1
+
+ return verts, faces
+
+from bpy.props import FloatProperty, IntProperty, BoolProperty, FloatVectorProperty
+
+
+class AddTorus(bpy.types.Operator):
+ '''Add a torus mesh'''
+ bl_idname = "mesh.primitive_torus_add"
+ bl_label = "Add Torus"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ major_radius = FloatProperty(name="Major Radius",
+ description="Radius from the origin to the center of the cross sections",
+ default=1.0, min=0.01, max=100.0)
+ minor_radius = FloatProperty(name="Minor Radius",
+ description="Radius of the torus' cross section",
+ default=0.25, min=0.01, max=100.0)
+ major_segments = IntProperty(name="Major Segments",
+ description="Number of segments for the main ring of the torus",
+ default=48, min=3, max=256)
+ minor_segments = IntProperty(name="Minor Segments",
+ description="Number of segments for the minor ring of the torus",
+ default=12, min=3, max=256)
+ use_abso = BoolProperty(name="Use Int+Ext Controls",
+ description="Use the Int / Ext controls for torus dimensions",
+ default=False)
+ abso_major_rad = FloatProperty(name="Exterior Radius",
+ description="Total Exterior Radius of the torus",
+ default=1.0, min=0.01, max=100.0)
+ abso_minor_rad = FloatProperty(name="Inside Radius",
+ description="Total Interior Radius of the torus",
+ default=0.5, min=0.01, max=100.0)
+
+ # generic transform props
+ view_align = BoolProperty(name="Align to View",
+ default=False)
+ location = FloatVectorProperty(name="Location",
+ subtype='TRANSLATION')
+ rotation = FloatVectorProperty(name="Rotation",
+ subtype='EULER')
+
+ def execute(self, context):
+
+ if self.use_abso == True:
+ extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5
+ self.major_radius = self.abso_minor_rad + extra_helper
+ self.minor_radius = extra_helper
+
+ verts_loc, faces = add_torus(self.major_radius,
+ self.minor_radius,
+ self.major_segments,
+ self.minor_segments)
+
+ mesh = bpy.data.meshes.new("Torus")
+
+ mesh.vertices.add(len(verts_loc) // 3)
+ mesh.faces.add(len(faces) // 4)
+
+ mesh.vertices.foreach_set("co", verts_loc)
+ mesh.faces.foreach_set("vertices_raw", faces)
+ mesh.update()
+
+ import add_object_utils
+ add_object_utils.object_data_add(context, mesh, operator=self)
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/animsys_update.py b/release/scripts/startup/bl_operators/animsys_update.py
new file mode 100644
index 00000000000..eb14ab7eb72
--- /dev/null
+++ b/release/scripts/startup/bl_operators/animsys_update.py
@@ -0,0 +1,696 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+data_path_update = [
+ ("ClothCollisionSettings", "min_distance", "distance_min"),
+ ("ClothCollisionSettings", "self_min_distance", "self_distance_min"),
+ ("ClothCollisionSettings", "enable_collision", "use_collision"),
+ ("ClothCollisionSettings", "enable_self_collision", "use_self_collision"),
+ ("ClothSettings", "pin_cloth", "use_pin_cloth"),
+ ("ClothSettings", "stiffness_scaling", "use_stiffness_scale"),
+ ("CollisionSettings", "random_damping", "damping_random"),
+ ("CollisionSettings", "random_friction", "friction_random"),
+ ("CollisionSettings", "inner_thickness", "thickness_inner"),
+ ("CollisionSettings", "outer_thickness", "thickness_outer"),
+ ("CollisionSettings", "kill_particles", "use_particle_kill"),
+ ("Constraint", "proxy_local", "is_proxy_local"),
+ ("ActionConstraint", "maximum", "max"),
+ ("ActionConstraint", "minimum", "min"),
+ ("FollowPathConstraint", "use_fixed_position", "use_fixed_location"),
+ ("KinematicConstraint", "chain_length", "chain_count"),
+ ("KinematicConstraint", "pos_lock_x", "lock_location_x"),
+ ("KinematicConstraint", "pos_lock_y", "lock_location_y"),
+ ("KinematicConstraint", "pos_lock_z", "lock_location_z"),
+ ("KinematicConstraint", "rot_lock_x", "lock_rotation_x"),
+ ("KinematicConstraint", "rot_lock_y", "lock_rotation_y"),
+ ("KinematicConstraint", "rot_lock_z", "lock_rotation_z"),
+ ("KinematicConstraint", "axis_reference", "reference_axis"),
+ ("KinematicConstraint", "use_position", "use_location"),
+ ("LimitLocationConstraint", "maximum_x", "max_x"),
+ ("LimitLocationConstraint", "maximum_y", "max_y"),
+ ("LimitLocationConstraint", "maximum_z", "max_z"),
+ ("LimitLocationConstraint", "minimum_x", "min_x"),
+ ("LimitLocationConstraint", "minimum_y", "min_y"),
+ ("LimitLocationConstraint", "minimum_z", "min_z"),
+ ("LimitLocationConstraint", "use_maximum_x", "use_max_x"),
+ ("LimitLocationConstraint", "use_maximum_y", "use_max_y"),
+ ("LimitLocationConstraint", "use_maximum_z", "use_max_z"),
+ ("LimitLocationConstraint", "use_minimum_x", "use_min_x"),
+ ("LimitLocationConstraint", "use_minimum_y", "use_min_y"),
+ ("LimitLocationConstraint", "use_minimum_z", "use_min_z"),
+ ("LimitLocationConstraint", "limit_transform", "use_transform_limit"),
+ ("LimitRotationConstraint", "maximum_x", "max_x"),
+ ("LimitRotationConstraint", "maximum_y", "max_y"),
+ ("LimitRotationConstraint", "maximum_z", "max_z"),
+ ("LimitRotationConstraint", "minimum_x", "min_x"),
+ ("LimitRotationConstraint", "minimum_y", "min_y"),
+ ("LimitRotationConstraint", "minimum_z", "min_z"),
+ ("LimitRotationConstraint", "limit_transform", "use_transform_limit"),
+ ("LimitScaleConstraint", "maximum_x", "max_x"),
+ ("LimitScaleConstraint", "maximum_y", "max_y"),
+ ("LimitScaleConstraint", "maximum_z", "max_z"),
+ ("LimitScaleConstraint", "minimum_x", "min_x"),
+ ("LimitScaleConstraint", "minimum_y", "min_y"),
+ ("LimitScaleConstraint", "minimum_z", "min_z"),
+ ("LimitScaleConstraint", "use_maximum_x", "use_max_x"),
+ ("LimitScaleConstraint", "use_maximum_y", "use_max_y"),
+ ("LimitScaleConstraint", "use_maximum_z", "use_max_z"),
+ ("LimitScaleConstraint", "use_minimum_x", "use_min_x"),
+ ("LimitScaleConstraint", "use_minimum_y", "use_min_y"),
+ ("LimitScaleConstraint", "use_minimum_z", "use_min_z"),
+ ("LimitScaleConstraint", "limit_transform", "use_transform_limit"),
+ ("PivotConstraint", "enabled_rotation_range", "rotation_range"),
+ ("PivotConstraint", "use_relative_position", "use_relative_location"),
+ ("PythonConstraint", "number_of_targets", "target_count"),
+ ("SplineIKConstraint", "chain_length", "chain_count"),
+ ("SplineIKConstraint", "chain_offset", "use_chain_offset"),
+ ("SplineIKConstraint", "even_divisions", "use_even_divisions"),
+ ("SplineIKConstraint", "y_stretch", "use_y_stretch"),
+ ("SplineIKConstraint", "xz_scaling_mode", "xz_scale_mode"),
+ ("StretchToConstraint", "original_length", "rest_length"),
+ ("TrackToConstraint", "target_z", "use_target_z"),
+ ("TransformConstraint", "extrapolate_motion", "use_motion_extrapolate"),
+ ("FieldSettings", "do_location", "apply_to_location"),
+ ("FieldSettings", "do_rotation", "apply_to_rotation"),
+ ("FieldSettings", "maximum_distance", "distance_max"),
+ ("FieldSettings", "minimum_distance", "distance_min"),
+ ("FieldSettings", "radial_maximum", "radial_max"),
+ ("FieldSettings", "radial_minimum", "radial_min"),
+ ("FieldSettings", "force_2d", "use_2d_force"),
+ ("FieldSettings", "do_absorption", "use_absorption"),
+ ("FieldSettings", "global_coordinates", "use_global_coords"),
+ ("FieldSettings", "guide_path_add", "use_guide_path_add"),
+ ("FieldSettings", "multiple_springs", "use_multiple_springs"),
+ ("FieldSettings", "use_coordinates", "use_object_coords"),
+ ("FieldSettings", "root_coordinates", "use_root_coords"),
+ ("ControlFluidSettings", "reverse_frames", "use_reverse_frames"),
+ ("DomainFluidSettings", "real_world_size", "simulation_scale"),
+ ("DomainFluidSettings", "surface_smoothing", "surface_smooth"),
+ ("DomainFluidSettings", "reverse_frames", "use_reverse_frames"),
+ ("DomainFluidSettings", "generate_speed_vectors", "use_speed_vectors"),
+ ("DomainFluidSettings", "override_time", "use_time_override"),
+ ("FluidFluidSettings", "export_animated_mesh", "use_animated_mesh"),
+ ("InflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
+ ("InflowFluidSettings", "local_coordinates", "use_local_coords"),
+ ("ObstacleFluidSettings", "export_animated_mesh", "use_animated_mesh"),
+ ("OutflowFluidSettings", "export_animated_mesh", "use_animated_mesh"),
+ ("ParticleFluidSettings", "drops", "use_drops"),
+ ("ParticleFluidSettings", "floats", "use_floats"),
+ ("Armature", "drawtype", "draw_type"),
+ ("Armature", "layer_protection", "layers_protected"),
+ ("Armature", "auto_ik", "use_auto_ik"),
+ ("Armature", "delay_deform", "use_deform_delay"),
+ ("Armature", "deform_envelope", "use_deform_envelopes"),
+ ("Armature", "deform_quaternion", "use_deform_preserve_volume"),
+ ("Armature", "deform_vertexgroups", "use_deform_vertex_groups"),
+ ("Armature", "x_axis_mirror", "use_mirror_x"),
+ ("Curve", "width", "offset"),
+ ("Image", "animation_speed", "fps"),
+ ("Image", "animation_end", "frame_end"),
+ ("Image", "animation_start", "frame_start"),
+ ("Image", "animated", "use_animation"),
+ ("Image", "clamp_x", "use_clamp_x"),
+ ("Image", "clamp_y", "use_clamp_y"),
+ ("Image", "premultiply", "use_premultiply"),
+ ("AreaLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
+ ("AreaLamp", "only_shadow", "use_only_shadow"),
+ ("AreaLamp", "shadow_layer", "use_shadow_layer"),
+ ("AreaLamp", "umbra", "use_umbra"),
+ ("PointLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
+ ("PointLamp", "only_shadow", "use_only_shadow"),
+ ("PointLamp", "shadow_layer", "use_shadow_layer"),
+ ("PointLamp", "sphere", "use_sphere"),
+ ("SpotLamp", "shadow_ray_sampling_method", "shadow_ray_sample_method"),
+ ("SpotLamp", "auto_clip_end", "use_auto_clip_end"),
+ ("SpotLamp", "auto_clip_start", "use_auto_clip_start"),
+ ("SpotLamp", "only_shadow", "use_only_shadow"),
+ ("SpotLamp", "shadow_layer", "use_shadow_layer"),
+ ("SpotLamp", "sphere", "use_sphere"),
+ ("SunLamp", "only_shadow", "use_only_shadow"),
+ ("SunLamp", "shadow_layer", "use_shadow_layer"),
+ ("Material", "z_offset", "offset_z"),
+ ("Material", "shadow_casting_alpha", "shadow_cast_alpha"),
+ ("Material", "cast_approximate", "use_cast_approximate"),
+ ("Material", "cast_buffer_shadows", "use_cast_buffer_shadows"),
+ ("Material", "cast_shadows_only", "use_cast_shadows_only"),
+ ("Material", "face_texture", "use_face_texture"),
+ ("Material", "face_texture_alpha", "use_face_texture_alpha"),
+ ("Material", "full_oversampling", "use_full_oversampling"),
+ ("Material", "light_group_exclusive", "use_light_group_exclusive"),
+ ("Material", "object_color", "use_object_color"),
+ ("Material", "only_shadow", "use_only_shadow"),
+ ("Material", "ray_shadow_bias", "use_ray_shadow_bias"),
+ ("Material", "traceable", "use_raytrace"),
+ ("Material", "shadeless", "use_shadeless"),
+ ("Material", "tangent_shading", "use_tangent_shading"),
+ ("Material", "transparency", "use_transparency"),
+ ("Material", "receive_transparent_shadows", "use_transparent_shadows"),
+ ("Material", "vertex_color_light", "use_vertex_color_light"),
+ ("Material", "vertex_color_paint", "use_vertex_color_paint"),
+ ("Mesh", "autosmooth_angle", "auto_smooth_angle"),
+ ("Mesh", "autosmooth", "use_auto_smooth"),
+ ("Object", "max_draw_type", "draw_type"),
+ ("Object", "use_dupli_verts_rotation", "use_dupli_vertices_rotation"),
+ ("Object", "shape_key_edit_mode", "use_shape_key_edit_mode"),
+ ("Object", "slow_parent", "use_slow_parent"),
+ ("Object", "time_offset_add_parent", "use_time_offset_add_parent"),
+ ("Object", "time_offset_edit", "use_time_offset_edit"),
+ ("Object", "time_offset_parent", "use_time_offset_parent"),
+ ("Object", "time_offset_particle", "use_time_offset_particle"),
+ ("ParticleSettings", "adaptive_pix", "adaptive_pixel"),
+ ("ParticleSettings", "child_effector", "apply_effector_to_children"),
+ ("ParticleSettings", "child_guide", "apply_guide_to_children"),
+ ("ParticleSettings", "billboard_split_offset", "billboard_offset_split"),
+ ("ParticleSettings", "billboard_random_tilt", "billboard_tilt_random"),
+ ("ParticleSettings", "child_length_thres", "child_length_threshold"),
+ ("ParticleSettings", "child_random_size", "child_size_random"),
+ ("ParticleSettings", "clumppow", "clump_shape"),
+ ("ParticleSettings", "damp_factor", "damping"),
+ ("ParticleSettings", "draw_as", "draw_method"),
+ ("ParticleSettings", "random_factor", "factor_random"),
+ ("ParticleSettings", "grid_invert", "invert_grid"),
+ ("ParticleSettings", "random_length", "length_random"),
+ ("ParticleSettings", "random_lifetime", "lifetime_random"),
+ ("ParticleSettings", "billboard_lock", "lock_billboard"),
+ ("ParticleSettings", "boids_2d", "lock_boids_to_surface"),
+ ("ParticleSettings", "object_aligned_factor", "object_align_factor"),
+ ("ParticleSettings", "random_phase_factor", "phase_factor_random"),
+ ("ParticleSettings", "ren_as", "render_type"),
+ ("ParticleSettings", "rendered_child_nbr", "rendered_child_count"),
+ ("ParticleSettings", "random_rotation_factor", "rotation_factor_random"),
+ ("ParticleSettings", "rough1", "roughness_1"),
+ ("ParticleSettings", "rough1_size", "roughness_1_size"),
+ ("ParticleSettings", "rough2", "roughness_2"),
+ ("ParticleSettings", "rough2_size", "roughness_2_size"),
+ ("ParticleSettings", "rough2_thres", "roughness_2_threshold"),
+ ("ParticleSettings", "rough_end_shape", "roughness_end_shape"),
+ ("ParticleSettings", "rough_endpoint", "roughness_endpoint"),
+ ("ParticleSettings", "random_size", "size_random"),
+ ("ParticleSettings", "abs_path_time", "use_absolute_path_time"),
+ ("ParticleSettings", "animate_branching", "use_animate_branching"),
+ ("ParticleSettings", "branching", "use_branching"),
+ ("ParticleSettings", "died", "use_dead"),
+ ("ParticleSettings", "die_on_collision", "use_die_on_collision"),
+ ("ParticleSettings", "rotation_dynamic", "use_dynamic_rotation"),
+ ("ParticleSettings", "even_distribution", "use_even_distribution"),
+ ("ParticleSettings", "rand_group", "use_group_pick_random"),
+ ("ParticleSettings", "hair_bspline", "use_hair_bspline"),
+ ("ParticleSettings", "sizemass", "use_multiply_size_mass"),
+ ("ParticleSettings", "react_multiple", "use_react_multiple"),
+ ("ParticleSettings", "react_start_end", "use_react_start_end"),
+ ("ParticleSettings", "render_adaptive", "use_render_adaptive"),
+ ("ParticleSettings", "self_effect", "use_self_effect"),
+ ("ParticleSettings", "enable_simplify", "use_simplify"),
+ ("ParticleSettings", "size_deflect", "use_size_deflect"),
+ ("ParticleSettings", "render_strand", "use_strand_primitive"),
+ ("ParticleSettings", "symmetric_branching", "use_symmetric_branching"),
+ ("ParticleSettings", "velocity_length", "use_velocity_length"),
+ ("ParticleSettings", "whole_group", "use_whole_group"),
+ ("CloudsTexture", "noise_size", "noise_scale"),
+ ("DistortedNoiseTexture", "noise_size", "noise_scale"),
+ ("EnvironmentMapTexture", "filter_size_minimum", "use_filter_size_min"),
+ ("EnvironmentMapTexture", "mipmap_gauss", "use_mipmap_gauss"),
+ ("ImageTexture", "calculate_alpha", "use_calculate_alpha"),
+ ("ImageTexture", "checker_even", "use_checker_even"),
+ ("ImageTexture", "checker_odd", "use_checker_odd"),
+ ("ImageTexture", "filter_size_minimum", "use_filter_size_min"),
+ ("ImageTexture", "flip_axis", "use_flip_axis"),
+ ("ImageTexture", "mipmap_gauss", "use_mipmap_gauss"),
+ ("ImageTexture", "mirror_x", "use_mirror_x"),
+ ("ImageTexture", "mirror_y", "use_mirror_y"),
+ ("ImageTexture", "normal_map", "use_normal_map"),
+ ("MarbleTexture", "noise_size", "noise_scale"),
+ ("MarbleTexture", "noisebasis2", "noisebasis_2"),
+ ("MusgraveTexture", "highest_dimension", "dimension_max"),
+ ("MusgraveTexture", "noise_size", "noise_scale"),
+ ("StucciTexture", "noise_size", "noise_scale"),
+ ("VoronoiTexture", "coloring", "color_mode"),
+ ("VoronoiTexture", "noise_size", "noise_scale"),
+ ("WoodTexture", "noise_size", "noise_scale"),
+ ("WoodTexture", "noisebasis2", "noisebasis_2"),
+ ("World", "blend_sky", "use_sky_blend"),
+ ("World", "paper_sky", "use_sky_paper"),
+ ("World", "real_sky", "use_sky_real"),
+ ("ImageUser", "auto_refresh", "use_auto_refresh"),
+ ("MaterialHalo", "flares_sub", "flare_subflare_count"),
+ ("MaterialHalo", "flare_subsize", "flare_subflare_size"),
+ ("MaterialHalo", "line_number", "line_count"),
+ ("MaterialHalo", "rings", "ring_count"),
+ ("MaterialHalo", "star_tips", "star_tip_count"),
+ ("MaterialHalo", "xalpha", "use_extreme_alpha"),
+ ("MaterialHalo", "flare_mode", "use_flare_mode"),
+ ("MaterialHalo", "vertex_normal", "use_vertex_normal"),
+ ("MaterialPhysics", "align_to_normal", "use_normal_align"),
+ ("MaterialStrand", "min_size", "size_min"),
+ ("MaterialStrand", "blender_units", "use_blender_units"),
+ ("MaterialStrand", "surface_diffuse", "use_surface_diffuse"),
+ ("MaterialStrand", "tangent_shading", "use_tangent_shading"),
+ ("MaterialSubsurfaceScattering", "error_tolerance", "error_threshold"),
+ ("MaterialVolume", "depth_cutoff", "depth_threshold"),
+ ("MaterialVolume", "lighting_mode", "light_method"),
+ ("MaterialVolume", "step_calculation", "step_method"),
+ ("MaterialVolume", "external_shadows", "use_external_shadows"),
+ ("MaterialVolume", "light_cache", "use_light_cache"),
+ ("ArmatureModifier", "multi_modifier", "use_multi_modifier"),
+ ("ArrayModifier", "constant_offset_displacement", "constant_offset_displace"),
+ ("ArrayModifier", "merge_distance", "merge_threshold"),
+ ("ArrayModifier", "relative_offset_displacement", "relative_offset_displace"),
+ ("ArrayModifier", "constant_offset", "use_constant_offset"),
+ ("ArrayModifier", "merge_adjacent_vertices", "use_merge_vertices"),
+ ("ArrayModifier", "merge_end_vertices", "use_merge_vertices_cap"),
+ ("ArrayModifier", "add_offset_object", "use_object_offset"),
+ ("ArrayModifier", "relative_offset", "use_relative_offset"),
+ ("BevelModifier", "only_vertices", "use_only_vertices"),
+ ("CastModifier", "from_radius", "use_radius_as_size"),
+ ("DisplaceModifier", "midlevel", "mid_level"),
+ ("DisplaceModifier", "texture_coordinates", "texture_coords"),
+ ("EdgeSplitModifier", "use_sharp", "use_edge_sharp"),
+ ("ExplodeModifier", "split_edges", "use_edge_split"),
+ ("MirrorModifier", "merge_limit", "merge_threshold"),
+ ("MirrorModifier", "mirror_u", "use_mirror_u"),
+ ("MirrorModifier", "mirror_v", "use_mirror_v"),
+ ("MirrorModifier", "mirror_vertex_groups", "use_mirror_vertex_groups"),
+ ("ParticleInstanceModifier", "particle_system_number", "particle_system_index"),
+ ("ParticleInstanceModifier", "keep_shape", "use_preserve_shape"),
+ ("ShrinkwrapModifier", "cull_back_faces", "use_cull_back_faces"),
+ ("ShrinkwrapModifier", "cull_front_faces", "use_cull_front_faces"),
+ ("ShrinkwrapModifier", "keep_above_surface", "use_keep_above_surface"),
+ ("SimpleDeformModifier", "lock_x_axis", "lock_x"),
+ ("SimpleDeformModifier", "lock_y_axis", "lock_y"),
+ ("SmokeModifier", "smoke_type", "type"),
+ ("SubsurfModifier", "subsurf_uv", "use_subsurf_uv"),
+ ("UVProjectModifier", "num_projectors", "projector_count"),
+ ("UVProjectModifier", "override_image", "use_image_override"),
+ ("WaveModifier", "texture_coordinates", "texture_coords"),
+ ("WaveModifier", "x_normal", "use_normal_x"),
+ ("WaveModifier", "y_normal", "use_normal_y"),
+ ("WaveModifier", "z_normal", "use_normal_z"),
+ ("NlaStrip", "blending", "blend_type"),
+ ("NlaStrip", "animated_influence", "use_animated_influence"),
+ ("NlaStrip", "animated_time", "use_animated_time"),
+ ("NlaStrip", "animated_time_cyclic", "use_animated_time_cyclic"),
+ ("NlaStrip", "auto_blending", "use_auto_blend"),
+ ("CompositorNodeAlphaOver", "convert_premul", "use_premultiply"),
+ ("CompositorNodeBlur", "sizex", "size_x"),
+ ("CompositorNodeBlur", "sizey", "size_y"),
+ ("CompositorNodeChannelMatte", "algorithm", "limit_method"),
+ ("CompositorNodeChromaMatte", "acceptance", "tolerance"),
+ ("CompositorNodeColorBalance", "correction_formula", "correction_method"),
+ ("CompositorNodeColorSpill", "algorithm", "limit_method"),
+ ("CompositorNodeColorSpill", "unspill", "use_unspill"),
+ ("CompositorNodeCrop", "x2", "max_x"),
+ ("CompositorNodeCrop", "y2", "max_y"),
+ ("CompositorNodeCrop", "x1", "min_x"),
+ ("CompositorNodeCrop", "y1", "min_y"),
+ ("CompositorNodeCrop", "crop_size", "use_crop_size"),
+ ("CompositorNodeDefocus", "max_blur", "blur_max"),
+ ("CompositorNodeDefocus", "gamma_correction", "use_gamma_correction"),
+ ("CompositorNodeGlare", "rotate_45", "use_rotate_45"),
+ ("CompositorNodeImage", "auto_refresh", "use_auto_refresh"),
+ ("CompositorNodeLensdist", "projector", "use_projector"),
+ ("CompositorNodeVecBlur", "max_speed", "speed_max"),
+ ("CompositorNodeVecBlur", "min_speed", "speed_min"),
+ ("ShaderNodeMapping", "maximum", "max"),
+ ("ShaderNodeMapping", "minimum", "min"),
+ ("ShaderNodeMapping", "clamp_maximum", "use_max"),
+ ("ShaderNodeMapping", "clamp_minimum", "use_min"),
+ ("VertexPaint", "all_faces", "use_all_faces"),
+ ("VertexPaint", "spray", "use_spray"),
+ ("ParticleEdit", "add_keys", "default_key_count"),
+ ("ParticleEdit", "selection_mode", "select_mode"),
+ ("ParticleEdit", "auto_velocity", "use_auto_velocity"),
+ ("ParticleEdit", "add_interpolate", "use_default_interpolate"),
+ ("ParticleEdit", "emitter_deflect", "use_emitter_deflect"),
+ ("ParticleEdit", "fade_time", "use_fade_time"),
+ ("ParticleEdit", "keep_lengths", "use_preserve_length"),
+ ("ParticleEdit", "keep_root", "use_preserve_root"),
+ ("ParticleSystem", "vertex_group_clump_negate", "invert_vertex_group_clump"),
+ ("ParticleSystem", "vertex_group_density_negate", "invert_vertex_group_density"),
+ ("ParticleSystem", "vertex_group_field_negate", "invert_vertex_group_field"),
+ ("ParticleSystem", "vertex_group_kink_negate", "invert_vertex_group_kink"),
+ ("ParticleSystem", "vertex_group_length_negate", "invert_vertex_group_length"),
+ ("ParticleSystem", "vertex_group_rotation_negate", "invert_vertex_group_rotation"),
+ ("ParticleSystem", "vertex_group_roughness1_negate", "invert_vertex_group_roughness_1"),
+ ("ParticleSystem", "vertex_group_roughness2_negate", "invert_vertex_group_roughness_2"),
+ ("ParticleSystem", "vertex_group_roughness_end_negate", "invert_vertex_group_roughness_end"),
+ ("ParticleSystem", "vertex_group_size_negate", "invert_vertex_group_size"),
+ ("ParticleSystem", "vertex_group_tangent_negate", "invert_vertex_group_tangent"),
+ ("ParticleSystem", "vertex_group_velocity_negate", "invert_vertex_group_velocity"),
+ ("ParticleSystem", "hair_dynamics", "use_hair_dynamics"),
+ ("ParticleSystem", "keyed_timing", "use_keyed_timing"),
+ ("PointDensity", "falloff_softness", "falloff_soft"),
+ ("PointDensity", "particle_cache", "particle_cache_space"),
+ ("PointDensity", "turbulence_size", "turbulence_scale"),
+ ("PointDensity", "turbulence", "use_turbulence"),
+ ("PointDensity", "vertices_cache", "vertex_cache_space"),
+ ("PoseBone", "ik_lin_weight", "ik_linear_weight"),
+ ("PoseBone", "ik_rot_weight", "ik_rotation_weight"),
+ ("PoseBone", "ik_limit_x", "use_ik_limit_x"),
+ ("PoseBone", "ik_limit_y", "use_ik_limit_y"),
+ ("PoseBone", "ik_limit_z", "use_ik_limit_z"),
+ ("PoseBone", "ik_lin_control", "use_ik_linear_control"),
+ ("PoseBone", "ik_rot_control", "use_ik_rotation_control"),
+ ("Bone", "use_hinge", "use_inherit_rotation"),
+ ("SPHFluidSettings", "spring_k", "spring_force"),
+ ("SPHFluidSettings", "stiffness_k", "stiffness"),
+ ("SPHFluidSettings", "stiffness_knear", "stiffness_near"),
+ ("SceneGameData", "framing_color", "frame_color"),
+ ("SceneGameData", "framing_type", "frame_type"),
+ ("SceneGameData", "eye_separation", "stereo_eye_separation"),
+ ("SceneGameData", "activity_culling", "use_activity_culling"),
+ ("SceneGameData", "auto_start", "use_auto_start"),
+ ("SceneGameData", "glsl_extra_textures", "use_glsl_extra_textures"),
+ ("SceneGameData", "glsl_lights", "use_glsl_lights"),
+ ("SceneGameData", "glsl_nodes", "use_glsl_nodes"),
+ ("SceneGameData", "glsl_ramps", "use_glsl_ramps"),
+ ("SceneGameData", "glsl_shaders", "use_glsl_shaders"),
+ ("SceneGameData", "glsl_shadows", "use_glsl_shadows"),
+ ("Sequence", "blend_opacity", "blend_alpha"),
+ ("Sequence", "blend_mode", "blend_type"),
+ ("Sequence", "frame_final_length", "frame_final_duration"),
+ ("Sequence", "use_effect_default_fade", "use_default_fade"),
+ ("SequenceColorBalance", "inverse_gain", "invert_gain"),
+ ("SequenceColorBalance", "inverse_gamma", "invert_gamma"),
+ ("SequenceColorBalance", "inverse_lift", "invert_lift"),
+ ("EffectSequence", "multiply_colors", "color_multiply"),
+ ("EffectSequence", "de_interlace", "use_deinterlace"),
+ ("EffectSequence", "flip_x", "use_flip_x"),
+ ("EffectSequence", "flip_y", "use_flip_y"),
+ ("EffectSequence", "convert_float", "use_float"),
+ ("EffectSequence", "premultiply", "use_premultiply"),
+ ("EffectSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("EffectSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("EffectSequence", "reverse_frames", "use_reverse_frames"),
+ ("GlowSequence", "blur_distance", "blur_radius"),
+ ("GlowSequence", "only_boost", "use_only_boost"),
+ ("SpeedControlSequence", "curve_compress_y", "use_curve_compress_y"),
+ ("SpeedControlSequence", "curve_velocity", "use_curve_velocity"),
+ ("SpeedControlSequence", "frame_blending", "use_frame_blend"),
+ ("TransformSequence", "uniform_scale", "use_uniform_scale"),
+ ("ImageSequence", "animation_end_offset", "animation_offset_end"),
+ ("ImageSequence", "animation_start_offset", "animation_offset_start"),
+ ("ImageSequence", "multiply_colors", "color_multiply"),
+ ("ImageSequence", "de_interlace", "use_deinterlace"),
+ ("ImageSequence", "flip_x", "use_flip_x"),
+ ("ImageSequence", "flip_y", "use_flip_y"),
+ ("ImageSequence", "convert_float", "use_float"),
+ ("ImageSequence", "premultiply", "use_premultiply"),
+ ("ImageSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("ImageSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("ImageSequence", "reverse_frames", "use_reverse_frames"),
+ ("MetaSequence", "animation_end_offset", "animation_offset_end"),
+ ("MetaSequence", "animation_start_offset", "animation_offset_start"),
+ ("MetaSequence", "multiply_colors", "color_multiply"),
+ ("MetaSequence", "de_interlace", "use_deinterlace"),
+ ("MetaSequence", "flip_x", "use_flip_x"),
+ ("MetaSequence", "flip_y", "use_flip_y"),
+ ("MetaSequence", "convert_float", "use_float"),
+ ("MetaSequence", "premultiply", "use_premultiply"),
+ ("MetaSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("MetaSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("MetaSequence", "reverse_frames", "use_reverse_frames"),
+ ("MovieSequence", "animation_end_offset", "animation_offset_end"),
+ ("MovieSequence", "animation_start_offset", "animation_offset_start"),
+ ("MovieSequence", "multiply_colors", "color_multiply"),
+ ("MovieSequence", "de_interlace", "use_deinterlace"),
+ ("MovieSequence", "flip_x", "use_flip_x"),
+ ("MovieSequence", "flip_y", "use_flip_y"),
+ ("MovieSequence", "convert_float", "use_float"),
+ ("MovieSequence", "premultiply", "use_premultiply"),
+ ("MovieSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("MovieSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("MovieSequence", "reverse_frames", "use_reverse_frames"),
+ ("MulticamSequence", "animation_end_offset", "animation_offset_end"),
+ ("MulticamSequence", "animation_start_offset", "animation_offset_start"),
+ ("MulticamSequence", "multiply_colors", "color_multiply"),
+ ("MulticamSequence", "de_interlace", "use_deinterlace"),
+ ("MulticamSequence", "flip_x", "use_flip_x"),
+ ("MulticamSequence", "flip_y", "use_flip_y"),
+ ("MulticamSequence", "convert_float", "use_float"),
+ ("MulticamSequence", "premultiply", "use_premultiply"),
+ ("MulticamSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("MulticamSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("MulticamSequence", "reverse_frames", "use_reverse_frames"),
+ ("SceneSequence", "animation_end_offset", "animation_offset_end"),
+ ("SceneSequence", "animation_start_offset", "animation_offset_start"),
+ ("SceneSequence", "multiply_colors", "color_multiply"),
+ ("SceneSequence", "de_interlace", "use_deinterlace"),
+ ("SceneSequence", "flip_x", "use_flip_x"),
+ ("SceneSequence", "flip_y", "use_flip_y"),
+ ("SceneSequence", "convert_float", "use_float"),
+ ("SceneSequence", "premultiply", "use_premultiply"),
+ ("SceneSequence", "proxy_custom_directory", "use_proxy_custom_directory"),
+ ("SceneSequence", "proxy_custom_file", "use_proxy_custom_file"),
+ ("SceneSequence", "reverse_frames", "use_reverse_frames"),
+ ("SoundSequence", "animation_end_offset", "animation_offset_end"),
+ ("SoundSequence", "animation_start_offset", "animation_offset_start"),
+ ("SmokeDomainSettings", "smoke_domain_colli", "collision_extents"),
+ ("SmokeDomainSettings", "smoke_cache_high_comp", "point_cache_compress_high_type"),
+ ("SmokeDomainSettings", "smoke_cache_comp", "point_cache_compress_type"),
+ ("SmokeDomainSettings", "maxres", "resolution_max"),
+ ("SmokeDomainSettings", "smoothemitter", "smooth_emitter"),
+ ("SmokeDomainSettings", "dissolve_smoke", "use_dissolve_smoke"),
+ ("SmokeDomainSettings", "dissolve_smoke_log", "use_dissolve_smoke_log"),
+ ("SmokeDomainSettings", "highres", "use_high_resolution"),
+ ("SoftBodySettings", "bending", "bend"),
+ ("SoftBodySettings", "error_limit", "error_threshold"),
+ ("SoftBodySettings", "lcom", "location_mass_center"),
+ ("SoftBodySettings", "lrot", "rotation_estimate"),
+ ("SoftBodySettings", "lscale", "scale_estimate"),
+ ("SoftBodySettings", "maxstep", "step_max"),
+ ("SoftBodySettings", "minstep", "step_min"),
+ ("SoftBodySettings", "diagnose", "use_diagnose"),
+ ("SoftBodySettings", "edge_collision", "use_edge_collision"),
+ ("SoftBodySettings", "estimate_matrix", "use_estimate_matrix"),
+ ("SoftBodySettings", "face_collision", "use_face_collision"),
+ ("SoftBodySettings", "self_collision", "use_self_collision"),
+ ("SoftBodySettings", "stiff_quads", "use_stiff_quads"),
+ ("TexMapping", "maximum", "max"),
+ ("TexMapping", "minimum", "min"),
+ ("TexMapping", "has_maximum", "use_max"),
+ ("TexMapping", "has_minimum", "use_min"),
+ ("TextCharacterFormat", "bold", "use_bold"),
+ ("TextCharacterFormat", "italic", "use_italic"),
+ ("TextCharacterFormat", "underline", "use_underline"),
+ ("TextureSlot", "rgb_to_intensity", "use_rgb_to_intensity"),
+ ("TextureSlot", "stencil", "use_stencil"),
+ ("LampTextureSlot", "texture_coordinates", "texture_coords"),
+ ("LampTextureSlot", "map_color", "use_map_color"),
+ ("LampTextureSlot", "map_shadow", "use_map_shadow"),
+ ("MaterialTextureSlot", "coloremission_factor", "color_emission_factor"),
+ ("MaterialTextureSlot", "colordiff_factor", "diffuse_color_factor"),
+ ("MaterialTextureSlot", "x_mapping", "mapping_x"),
+ ("MaterialTextureSlot", "y_mapping", "mapping_y"),
+ ("MaterialTextureSlot", "z_mapping", "mapping_z"),
+ ("MaterialTextureSlot", "colorreflection_factor", "reflection_color_factor"),
+ ("MaterialTextureSlot", "colorspec_factor", "specular_color_factor"),
+ ("MaterialTextureSlot", "texture_coordinates", "texture_coords"),
+ ("MaterialTextureSlot", "colortransmission_factor", "transmission_color_factor"),
+ ("MaterialTextureSlot", "from_dupli", "use_from_dupli"),
+ ("MaterialTextureSlot", "from_original", "use_from_original"),
+ ("MaterialTextureSlot", "map_alpha", "use_map_alpha"),
+ ("MaterialTextureSlot", "map_ambient", "use_map_ambient"),
+ ("MaterialTextureSlot", "map_colordiff", "use_map_color_diff"),
+ ("MaterialTextureSlot", "map_coloremission", "use_map_color_emission"),
+ ("MaterialTextureSlot", "map_colorreflection", "use_map_color_reflection"),
+ ("MaterialTextureSlot", "map_colorspec", "use_map_color_spec"),
+ ("MaterialTextureSlot", "map_colortransmission", "use_map_color_transmission"),
+ ("MaterialTextureSlot", "map_density", "use_map_density"),
+ ("MaterialTextureSlot", "map_diffuse", "use_map_diffuse"),
+ ("MaterialTextureSlot", "map_displacement", "use_map_displacement"),
+ ("MaterialTextureSlot", "map_emission", "use_map_emission"),
+ ("MaterialTextureSlot", "map_emit", "use_map_emit"),
+ ("MaterialTextureSlot", "map_hardness", "use_map_hardness"),
+ ("MaterialTextureSlot", "map_mirror", "use_map_mirror"),
+ ("MaterialTextureSlot", "map_normal", "use_map_normal"),
+ ("MaterialTextureSlot", "map_raymir", "use_map_raymir"),
+ ("MaterialTextureSlot", "map_reflection", "use_map_reflect"),
+ ("MaterialTextureSlot", "map_scattering", "use_map_scatter"),
+ ("MaterialTextureSlot", "map_specular", "use_map_specular"),
+ ("MaterialTextureSlot", "map_translucency", "use_map_translucency"),
+ ("MaterialTextureSlot", "map_warp", "use_map_warp"),
+ ("WorldTextureSlot", "texture_coordinates", "texture_coords"),
+ ("WorldTextureSlot", "map_blend", "use_map_blend"),
+ ("WorldTextureSlot", "map_horizon", "use_map_horizon"),
+ ("WorldTextureSlot", "map_zenith_down", "use_map_zenith_down"),
+ ("WorldTextureSlot", "map_zenith_up", "use_map_zenith_up"),
+ ("VoxelData", "still_frame_number", "still_frame"),
+ ("WorldLighting", "ao_blend_mode", "ao_blend_type"),
+ ("WorldLighting", "error_tolerance", "error_threshold"),
+ ("WorldLighting", "use_ambient_occlusion", "use_ambient_occlusian"),
+ ("WorldLighting", "pixel_cache", "use_cache"),
+ ("WorldLighting", "use_environment_lighting", "use_environment_light"),
+ ("WorldLighting", "use_indirect_lighting", "use_indirect_light"),
+ ("WorldStarsSettings", "color_randomization", "color_random"),
+ ("WorldStarsSettings", "min_distance", "distance_min"),
+ ("WorldLighting", "falloff", "use_falloff"),
+ ("Constraint", "disabled", "is_valid"),
+ ("ClampToConstraint", "cyclic", "use_cyclic"),
+ ("ImageTexture", "filter", "filter_type"),
+ ("ImageTexture", "interpolation", "use_interpolation"),
+ ("ImageTexture", "mipmap", "use_mipmap"),
+ ("ImageUser", "frames", "frame_duration"),
+ ("ImageUser", "offset", "frame_offset"),
+ ("ImageUser", "cyclic", "use_cyclic"),
+ ("ArmatureModifier", "invert", "invert_vertex_group"),
+ ("ArmatureModifier", "quaternion", "use_deform_preserve_volume"),
+ ("ArrayModifier", "length", "fit_length"),
+ ("BevelModifier", "angle", "angle_limit"),
+ ("BuildModifier", "length", "frame_duration"),
+ ("BuildModifier", "randomize", "use_random_order"),
+ ("CastModifier", "x", "use_x"),
+ ("CastModifier", "y", "use_y"),
+ ("CastModifier", "z", "use_z"),
+ ("ExplodeModifier", "size", "use_size"),
+ ("MaskModifier", "invert", "invert_vertex_group"),
+ ("MeshDeformModifier", "invert", "invert_vertex_group"),
+ ("MeshDeformModifier", "dynamic", "use_dynamic_bind"),
+ ("MirrorModifier", "clip", "use_clip"),
+ ("MirrorModifier", "x", "use_x"),
+ ("MirrorModifier", "y", "use_y"),
+ ("MirrorModifier", "z", "use_z"),
+ ("ParticleInstanceModifier", "children", "use_children"),
+ ("ParticleInstanceModifier", "normal", "use_normal"),
+ ("ParticleInstanceModifier", "size", "use_size"),
+ ("ShrinkwrapModifier", "negative", "use_negative_direction"),
+ ("ShrinkwrapModifier", "positive", "use_positive_direction"),
+ ("ShrinkwrapModifier", "x", "use_project_x"),
+ ("ShrinkwrapModifier", "y", "use_project_y"),
+ ("ShrinkwrapModifier", "z", "use_project_z"),
+ ("ShrinkwrapModifier", "mode", "wrap_method"),
+ ("SimpleDeformModifier", "mode", "deform_method"),
+ ("SimpleDeformModifier", "relative", "use_relative"),
+ ("SmoothModifier", "repeat", "iterations"),
+ ("SmoothModifier", "x", "use_x"),
+ ("SmoothModifier", "y", "use_y"),
+ ("SmoothModifier", "z", "use_z"),
+ ("SolidifyModifier", "invert", "invert_vertex_group"),
+ ("WaveModifier", "cyclic", "use_cyclic"),
+ ("WaveModifier", "normals", "use_normal"),
+ ("WaveModifier", "x", "use_x"),
+ ("WaveModifier", "y", "use_y"),
+ ("DampedTrackConstraint", "track", "track_axis"),
+ ("FloorConstraint", "sticky", "use_sticky"),
+ ("FollowPathConstraint", "forward", "forward_axis"),
+ ("FollowPathConstraint", "up", "up_axis"),
+ ("LockedTrackConstraint", "lock", "lock_axis"),
+ ("LockedTrackConstraint", "track", "track_axis"),
+ ("MaintainVolumeConstraint", "axis", "free_axis"),
+ ("TrackToConstraint", "track", "track_axis"),
+ ("TrackToConstraint", "up", "up_axis"),
+ ("GameProperty", "debug", "show_debug"),
+ ("Image", "tiles", "use_tiles"),
+ ("Lamp", "diffuse", "use_diffuse"),
+ ("Lamp", "negative", "use_negative"),
+ ("Lamp", "layer", "use_own_layer"),
+ ("Lamp", "specular", "use_specular"),
+ ("AreaLamp", "dither", "use_dither"),
+ ("AreaLamp", "jitter", "use_jitter"),
+ ("SpotLamp", "square", "use_square"),
+ ("Material", "cubic", "use_cubic"),
+ ("Material", "shadows", "use_shadows"),
+ ("ParticleSettings", "amount", "count"),
+ ("ParticleSettings", "display", "draw_percentage"),
+ ("ParticleSettings", "velocity", "show_velocity"),
+ ("ParticleSettings", "trand", "use_emit_random"),
+ ("ParticleSettings", "parent", "use_parent_particles"),
+ ("ParticleSettings", "emitter", "use_render_emitter"),
+ ("ParticleSettings", "viewport", "use_simplify_viewport"),
+ ("Texture", "brightness", "intensity"),
+ ("CloudsTexture", "stype", "cloud_type"),
+ ("EnvironmentMapTexture", "filter", "filter_type"),
+ ("EnvironmentMapTexture", "mipmap", "use_mipmap"),
+ ("MarbleTexture", "stype", "marble_type"),
+ ("StucciTexture", "stype", "stucci_type"),
+ ("WoodTexture", "stype", "wood_type"),
+ ("World", "range", "color_range"),
+ ("World", "lighting", "light_settings"),
+ ("World", "mist", "mist_settings"),
+ ("World", "stars", "star_settings"),
+ ("MaterialHalo", "lines", "use_lines"),
+ ("MaterialHalo", "ring", "use_ring"),
+ ("MaterialHalo", "soft", "use_soft"),
+ ("MaterialHalo", "star", "use_star"),
+ ("MaterialHalo", "texture", "use_texture"),
+ ("MaterialPhysics", "damp", "damping"),
+ ("MaterialRaytraceTransparency", "limit", "depth_max"),
+ ("NlaStrip", "reversed", "use_reverse"),
+ ("CompositorNodeBlur", "bokeh", "use_bokeh"),
+ ("CompositorNodeBlur", "gamma", "use_gamma_correction"),
+ ("CompositorNodeBlur", "relative", "use_relative"),
+ ("CompositorNodeChannelMatte", "high", "limit_max"),
+ ("CompositorNodeChannelMatte", "low", "limit_min"),
+ ("CompositorNodeChannelMatte", "channel", "matte_channel"),
+ ("CompositorNodeChromaMatte", "cutoff", "threshold"),
+ ("CompositorNodeColorMatte", "h", "color_hue"),
+ ("CompositorNodeColorMatte", "s", "color_saturation"),
+ ("CompositorNodeColorMatte", "v", "color_value"),
+ ("CompositorNodeDBlur", "wrap", "use_wrap"),
+ ("CompositorNodeDefocus", "preview", "use_preview"),
+ ("CompositorNodeHueSat", "hue", "color_hue"),
+ ("CompositorNodeHueSat", "sat", "color_saturation"),
+ ("CompositorNodeHueSat", "val", "color_value"),
+ ("CompositorNodeImage", "frames", "frame_duration"),
+ ("CompositorNodeImage", "offset", "frame_offset"),
+ ("CompositorNodeImage", "start", "frame_start"),
+ ("CompositorNodeImage", "cyclic", "use_cyclic"),
+ ("CompositorNodeInvert", "alpha", "invert_alpha"),
+ ("CompositorNodeInvert", "rgb", "invert_rgb"),
+ ("CompositorNodeLensdist", "fit", "use_fit"),
+ ("CompositorNodeLensdist", "jitter", "use_jitter"),
+ ("CompositorNodeMixRGB", "alpha", "use_alpha"),
+ ("CompositorNodeRotate", "filter", "filter_type"),
+ ("CompositorNodeTime", "end", "frame_end"),
+ ("CompositorNodeTime", "start", "frame_start"),
+ ("CompositorNodeVecBlur", "curved", "use_curved"),
+ ("ShaderNodeExtendedMaterial", "diffuse", "use_diffuse"),
+ ("ShaderNodeExtendedMaterial", "specular", "use_specular"),
+ ("ShaderNodeMaterial", "diffuse", "use_diffuse"),
+ ("ShaderNodeMaterial", "specular", "use_specular"),
+ ("ShaderNodeMixRGB", "alpha", "use_alpha"),
+ ("TextureNodeCurveTime", "end", "frame_end"),
+ ("TextureNodeCurveTime", "start", "frame_start"),
+ ("TextureNodeMixRGB", "alpha", "use_alpha"),
+ ("TextureSlot", "negate", "invert"),
+ ("TextureSlot", "size", "scale"),
+ ("SoftBodySettings", "damp", "damping"),
+ ("SequenceCrop", "right", "max_x"),
+ ("SequenceCrop", "top", "max_y"),
+ ("SequenceCrop", "bottom", "min_x"),
+ ("SequenceCrop", "left", "min_y"),
+ ("Sequence", "speed_fader", "speed_factor"),
+ ("SpeedControlSequence", "global_speed", "multiply_speed"),
+ ("SpeedControlSequence", "use_curve_velocity", "use_as_speed"),
+ ("SpeedControlSequence", "use_curve_compress_y", "scale_to_length"),
+ ]
+
+
+import bpy
+
+
+class UpdateAnimData(bpy.types.Operator):
+ '''Update data paths from 2.53 to edited data paths of drivers and fcurves'''
+ bl_idname = "anim.update_data_paths"
+ bl_label = "Update Animation Data"
+
+ def execute(self, context):
+ import animsys_refactor
+ animsys_refactor.update_data_paths(data_path_update)
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/fcurve_euler_filter.py b/release/scripts/startup/bl_operators/fcurve_euler_filter.py
new file mode 100644
index 00000000000..c7b249a1d0c
--- /dev/null
+++ b/release/scripts/startup/bl_operators/fcurve_euler_filter.py
@@ -0,0 +1,78 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+def main(context):
+ from math import pi
+
+ def cleanupEulCurve(fcv):
+ keys = []
+
+ for k in fcv.keyframe_points:
+ keys.append([k.handle_left.copy(), k.co.copy(), k.handle_right.copy()])
+
+ for i in range(len(keys)):
+ cur = keys[i]
+ prev = keys[i - 1] if i > 0 else None
+ next = keys[i + 1] if i < len(keys) - 1 else None
+
+ if prev is None:
+ continue
+
+ th = pi
+ if abs(prev[1][1] - cur[1][1]) >= th: # more than 180 degree jump
+ fac = pi * 2.0
+ if prev[1][1] > cur[1][1]:
+ while abs(cur[1][1] - prev[1][1]) >= th: # < prev[1][1]:
+ cur[0][1] += fac
+ cur[1][1] += fac
+ cur[2][1] += fac
+ elif prev[1][1] < cur[1][1]:
+ while abs(cur[1][1] - prev[1][1]) >= th:
+ cur[0][1] -= fac
+ cur[1][1] -= fac
+ cur[2][1] -= fac
+
+ for i in range(len(keys)):
+ for x in range(2):
+ fcv.keyframe_points[i].handle_left[x] = keys[i][0][x]
+ fcv.keyframe_points[i].co[x] = keys[i][1][x]
+ fcv.keyframe_points[i].handle_right[x] = keys[i][2][x]
+
+ flist = bpy.context.active_object.animation_data.action.fcurves
+ for f in flist:
+ if f.select and f.data_path.endswith("rotation_euler"):
+ cleanupEulCurve(f)
+
+
+class DiscontFilterOp(bpy.types.Operator):
+ """Fixes the most common causes of gimbal lock in the fcurves of the active bone"""
+ bl_idname = "graph.euler_filter"
+ bl_label = "Filter out discontinuities in the active fcurves"
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object != None
+
+ def execute(self, context):
+ main(context)
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py
new file mode 100644
index 00000000000..82e631e31d2
--- /dev/null
+++ b/release/scripts/startup/bl_operators/image.py
@@ -0,0 +1,189 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from bpy.props import StringProperty
+
+
+class EditExternally(bpy.types.Operator):
+ '''Edit image in an external application'''
+ bl_idname = "image.external_edit"
+ bl_label = "Image Edit Externally"
+ bl_options = {'REGISTER'}
+
+ filepath = StringProperty(name="File Path", description="Path to an image file", maxlen=1024, default="")
+
+ def _editor_guess(self, context):
+ import sys
+
+ image_editor = context.user_preferences.filepaths.image_editor
+
+ # use image editor in the preferences when available.
+ if not image_editor:
+ if sys.platform[:3] == "win":
+ image_editor = ["start"] # not tested!
+ elif sys.platform == "darwin":
+ image_editor = ["open"]
+ else:
+ image_editor = ["gimp"]
+ else:
+ if sys.platform == "darwin":
+ # blender file selector treats .app as a folder
+ # and will include a trailing backslash, so we strip it.
+ image_editor.rstrip('\\')
+ image_editor = ["open", "-a", image_editor]
+ else:
+ image_editor = [image_editor]
+
+ return image_editor
+
+ def execute(self, context):
+ import os
+ import subprocess
+ filepath = bpy.path.abspath(self.filepath)
+
+ if not os.path.exists(filepath):
+ self.report('ERROR', "Image path %r not found." % filepath)
+ return {'CANCELLED'}
+
+ cmd = self._editor_guess(context) + [filepath]
+
+ subprocess.Popen(cmd)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ try:
+ filepath = context.space_data.image.filepath
+ except:
+ self.report({'ERROR'}, "Image not found on disk")
+ return {'CANCELLED'}
+
+ self.filepath = filepath
+ self.execute(context)
+
+ return {'FINISHED'}
+
+
+class SaveDirty(bpy.types.Operator):
+ """Save all modified textures"""
+ bl_idname = "image.save_dirty"
+ bl_label = "Save Dirty"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ unique_paths = set()
+ for image in bpy.data.images:
+ if image.is_dirty:
+ filepath = bpy.path.abspath(image.filepath)
+ if "\\" not in filepath and "/" not in filepath:
+ self.report({'WARNING'}, "Invalid path: " + filepath)
+ elif filepath in unique_paths:
+ self.report({'WARNING'}, "Path used by more then one image: " + filepath)
+ else:
+ unique_paths.add(filepath)
+ image.save()
+ return {'FINISHED'}
+
+
+class ProjectEdit(bpy.types.Operator):
+ """Edit a snapshot if the viewport in an external image editor"""
+ bl_idname = "image.project_edit"
+ bl_label = "Project Edit"
+ bl_options = {'REGISTER'}
+
+ _proj_hack = [""]
+
+ def execute(self, context):
+ import os
+ import subprocess
+
+ EXT = "png" # could be made an option but for now ok
+
+ for image in bpy.data.images:
+ image.tag = True
+
+ if 'FINISHED' not in bpy.ops.paint.image_from_view():
+ return {'CANCELLED'}
+
+ image_new = None
+ for image in bpy.data.images:
+ if not image.tag:
+ image_new = image
+ break
+
+ if not image_new:
+ self.report({'ERROR'}, "Could not make new image")
+ return {'CANCELLED'}
+
+ filepath = os.path.basename(bpy.data.filepath)
+ filepath = os.path.splitext(filepath)[0]
+ # filepath = bpy.path.clean_name(filepath) # fixes <memory> rubbish, needs checking
+
+ if filepath.startswith(".") or filepath == "":
+ # TODO, have a way to check if the file is saved, assume startup.blend
+ tmpdir = context.user_preferences.filepaths.temporary_directory
+ filepath = os.path.join(tmpdir, "project_edit")
+ else:
+ filepath = "//" + filepath
+
+ obj = context.object
+
+ if obj:
+ filepath += "_" + bpy.path.clean_name(obj.name)
+
+ filepath_final = filepath + "." + EXT
+ i = 0
+
+ while os.path.exists(bpy.path.abspath(filepath_final)):
+ filepath_final = filepath + ("%.3d.%s" % (i, EXT))
+ i += 1
+
+ image_new.name = os.path.basename(filepath_final)
+ ProjectEdit._proj_hack[0] = image_new.name
+
+ image_new.filepath_raw = filepath_final # TODO, filepath raw is crummy
+ image_new.file_format = 'PNG'
+ image_new.save()
+
+ bpy.ops.image.external_edit(filepath=filepath_final)
+
+ return {'FINISHED'}
+
+
+class ProjectApply(bpy.types.Operator):
+ """Project edited image back onto the object"""
+ bl_idname = "image.project_apply"
+ bl_label = "Project Apply"
+ bl_options = {'REGISTER'}
+
+ def execute(self, context):
+ image_name = ProjectEdit._proj_hack[0] # TODO, deal with this nicer
+
+ try:
+ image = bpy.data.images[image_name]
+ except KeyError:
+ self.report({'ERROR'}, "Could not find image '%s'" % image_name)
+ return {'CANCELLED'}
+
+ image.reload()
+ bpy.ops.paint.project_image(image=image_name)
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/mesh.py b/release/scripts/startup/bl_operators/mesh.py
new file mode 100644
index 00000000000..a37a83f0f09
--- /dev/null
+++ b/release/scripts/startup/bl_operators/mesh.py
@@ -0,0 +1,172 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+class MeshSelectInteriorFaces(bpy.types.Operator):
+ '''Select faces where all edges have more then 2 face users.'''
+
+ bl_idname = "mesh.faces_select_interior"
+ bl_label = "Select Interior Faces"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return (ob and ob.type == 'MESH')
+
+ def execute(self, context):
+ ob = context.active_object
+ context.tool_settings.mesh_select_mode = False, False, True
+ is_editmode = (ob.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+ mesh = ob.data
+
+ face_list = mesh.faces[:]
+ face_edge_keys = [face.edge_keys for face in face_list]
+
+ edge_face_count = mesh.edge_face_count_dict
+
+ def test_interior(index):
+ for key in face_edge_keys[index]:
+ if edge_face_count[key] < 3:
+ return False
+ return True
+
+ for index, face in enumerate(face_list):
+ if(test_interior(index)):
+ face.select = True
+ else:
+ face.select = False
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ return {'FINISHED'}
+
+
+class MeshMirrorUV(bpy.types.Operator):
+ '''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
+ bl_idname = "mesh.faces_miror_uv"
+ bl_label = "Copy Mirrored UV coords"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return (ob and ob.type == 'MESH')
+
+ def execute(self, context):
+ DIR = 1 # TODO, make an option
+
+ from mathutils import Vector
+
+ ob = context.active_object
+ is_editmode = (ob.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+ mesh = ob.data
+
+ # mirror lookups
+ mirror_gt = {}
+ mirror_lt = {}
+
+ vcos = [v.co.to_tuple(5) for v in mesh.vertices]
+
+ for i, co in enumerate(vcos):
+ if co[0] > 0.0:
+ mirror_gt[co] = i
+ elif co[0] < 0.0:
+ mirror_lt[co] = i
+ else:
+ mirror_gt[co] = i
+ mirror_lt[co] = i
+
+ #for i, v in enumerate(mesh.vertices):
+ vmap = {}
+ for mirror_a, mirror_b in (mirror_gt, mirror_lt), (mirror_lt, mirror_gt):
+ for co, i in mirror_a.items():
+ nco = (-co[0], co[1], co[2])
+ j = mirror_b.get(nco)
+ if j is not None:
+ vmap[i] = j
+
+ active_uv_layer = None
+ for lay in mesh.uv_textures:
+ if lay.active:
+ active_uv_layer = lay.data
+ break
+
+ fuvs = [(uv.uv1, uv.uv2, uv.uv3, uv.uv4) for uv in active_uv_layer]
+ fuvs_cpy = [(uv[0].copy(), uv[1].copy(), uv[2].copy(), uv[3].copy()) for uv in fuvs]
+
+ # as a list
+ faces = mesh.faces[:]
+
+ fuvsel = [(False not in uv.select_uv) for uv in active_uv_layer]
+ fcents = [f.center for f in faces]
+
+ # find mirror faces
+ mirror_fm = {}
+ for i, f in enumerate(faces):
+ verts = list(f.vertices)
+ verts.sort()
+ verts = tuple(verts)
+ mirror_fm[verts] = i
+
+ fmap = {}
+ for i, f in enumerate(faces):
+ verts = [vmap.get(j) for j in f.vertices]
+ if None not in verts:
+ verts.sort()
+ j = mirror_fm.get(tuple(verts))
+ if j is not None:
+ fmap[i] = j
+
+ done = [False] * len(faces)
+ for i, j in fmap.items():
+
+ if not fuvsel[i] or not fuvsel[j]:
+ continue
+ elif DIR == 0 and fcents[i][0] < 0.0:
+ continue
+ elif DIR == 1 and fcents[i][0] > 0.0:
+ continue
+
+ # copy UVs
+ uv1 = fuvs[i]
+ uv2 = fuvs_cpy[j]
+
+ # get the correct rotation
+ v1 = faces[j].vertices[:]
+ v2 = [vmap[k] for k in faces[i].vertices[:]]
+
+ for k in range(len(uv1)):
+ k_map = v1.index(v2[k])
+ uv1[k].x = - (uv2[k_map].x - 0.5) + 0.5
+ uv1[k].y = uv2[k_map].y
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/nla.py b/release/scripts/startup/bl_operators/nla.py
new file mode 100644
index 00000000000..923ca92a162
--- /dev/null
+++ b/release/scripts/startup/bl_operators/nla.py
@@ -0,0 +1,170 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+def pose_info():
+ from mathutils import Matrix
+
+ info = {}
+
+ obj = bpy.context.object
+ pose = obj.pose
+
+ pose_items = pose.bones.items()
+
+ for name, pbone in pose_items:
+ binfo = {}
+ bone = pbone.bone
+
+ binfo["parent"] = getattr(bone.parent, "name", None)
+ binfo["bone"] = bone
+ binfo["pbone"] = pbone
+ binfo["matrix_local"] = bone.matrix_local.copy()
+ try:
+ binfo["matrix_local_inv"] = binfo["matrix_local"].inverted()
+ except:
+ binfo["matrix_local_inv"] = Matrix()
+
+ binfo["matrix"] = bone.matrix.copy()
+ binfo["matrix_pose"] = pbone.matrix.copy()
+ try:
+ binfo["matrix_pose_inv"] = binfo["matrix_pose"].inverted()
+ except:
+ binfo["matrix_pose_inv"] = Matrix()
+
+ print(binfo["matrix_pose"])
+ info[name] = binfo
+
+ for name, pbone in pose_items:
+ binfo = info[name]
+ binfo_parent = binfo.get("parent", None)
+ if binfo_parent:
+ binfo_parent = info[binfo_parent]
+
+ matrix = binfo["matrix_pose"]
+ rest_matrix = binfo["matrix_local"]
+
+ if binfo_parent:
+ matrix = binfo_parent["matrix_pose_inv"] * matrix
+ rest_matrix = binfo_parent["matrix_local_inv"] * rest_matrix
+
+ matrix = rest_matrix.inverted() * matrix
+
+ binfo["matrix_key"] = matrix.copy()
+
+ return info
+
+
+def bake(frame_start, frame_end, step=1, only_selected=False):
+ scene = bpy.context.scene
+ obj = bpy.context.object
+ pose = obj.pose
+
+ info_ls = []
+
+ frame_range = range(frame_start, frame_end + 1, step)
+
+ # could spped this up by applying steps here too...
+ for f in frame_range:
+ scene.frame_set(f)
+
+ info = pose_info()
+ info_ls.append(info)
+ f += 1
+
+ action = bpy.data.actions.new("Action")
+
+ bpy.context.object.animation_data.action = action
+
+ pose_items = pose.bones.items()
+
+ for name, pbone in pose_items:
+ if only_selected and not pbone.bone.select:
+ continue
+
+ for f in frame_range:
+ matrix = info_ls[int((f - frame_start) / step)][name]["matrix_key"]
+
+ #pbone.location = matrix.to_translation()
+ #pbone.rotation_quaternion = matrix.to_quaternion()
+ pbone.matrix_basis = matrix
+
+ pbone.keyframe_insert("location", -1, f, name)
+
+ rotation_mode = pbone.rotation_mode
+
+ if rotation_mode == 'QUATERNION':
+ pbone.keyframe_insert("rotation_quaternion", -1, f, name)
+ elif rotation_mode == 'AXIS_ANGLE':
+ pbone.keyframe_insert("rotation_axis_angle", -1, f, name)
+ else: # euler, XYZ, ZXY etc
+ pbone.keyframe_insert("rotation_euler", -1, f, name)
+
+ pbone.keyframe_insert("scale", -1, f, name)
+
+ return action
+
+
+from bpy.props import IntProperty, BoolProperty
+
+
+class BakeAction(bpy.types.Operator):
+ '''Bake animation to an Action'''
+ bl_idname = "nla.bake"
+ bl_label = "Bake Action"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ frame_start = IntProperty(name="Start Frame",
+ description="Start frame for baking",
+ default=1, min=1, max=300000)
+ frame_end = IntProperty(name="End Frame",
+ description="End frame for baking",
+ default=250, min=1, max=300000)
+ step = IntProperty(name="Frame Step",
+ description="Frame Step",
+ default=1, min=1, max=120)
+ only_selected = BoolProperty(name="Only Selected",
+ default=True)
+
+ def execute(self, context):
+
+ action = bake(self.frame_start, self.frame_end, self.step, self.only_selected)
+
+ # basic cleanup, could move elsewhere
+ for fcu in action.fcurves:
+ keyframe_points = fcu.keyframe_points
+ i = 1
+ while i < len(fcu.keyframe_points) - 1:
+ val_prev = keyframe_points[i - 1].co[1]
+ val_next = keyframe_points[i + 1].co[1]
+ val = keyframe_points[i].co[1]
+
+ if abs(val - val_prev) + abs(val - val_next) < 0.0001:
+ keyframe_points.remove(keyframe_points[i])
+ else:
+ i += 1
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
new file mode 100644
index 00000000000..db5eaccfc8f
--- /dev/null
+++ b/release/scripts/startup/bl_operators/object.py
@@ -0,0 +1,563 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from bpy.props import StringProperty, BoolProperty, EnumProperty, IntProperty
+
+
+class SelectPattern(bpy.types.Operator):
+ '''Select object matching a naming pattern'''
+ bl_idname = "object.select_pattern"
+ bl_label = "Select Pattern"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen=32, default="*")
+ case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default=False)
+ extend = BoolProperty(name="Extend", description="Extend the existing selection", default=True)
+
+ def execute(self, context):
+
+ import fnmatch
+
+ if self.case_sensitive:
+ pattern_match = fnmatch.fnmatchcase
+ else:
+ pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
+
+ obj = context.object
+ if obj and obj.mode == 'POSE':
+ items = obj.data.bones
+ elif obj and obj.type == 'ARMATURE' and obj.mode == 'EDIT':
+ items = obj.data.edit_bones
+ else:
+ items = context.visible_objects
+
+ # Can be pose bones or objects
+ for item in items:
+ if pattern_match(item.name, self.pattern):
+ item.select = True
+ elif not self.extend:
+ item.select = False
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_popup(self, event)
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.prop(self, "pattern")
+ row = layout.row()
+ row.prop(self, "case_sensitive")
+ row.prop(self, "extend")
+
+
+class SelectCamera(bpy.types.Operator):
+ '''Select object matching a naming pattern'''
+ bl_idname = "object.select_camera"
+ bl_label = "Select Camera"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.scene.camera is not None
+
+ def execute(self, context):
+ scene = context.scene
+ camera = scene.camera
+ if camera.name not in scene.objects:
+ self.report({'WARNING'}, "Active camera is not in this scene")
+
+ context.scene.objects.active = camera
+ camera.select = True
+ return {'FINISHED'}
+
+
+class SelectHierarchy(bpy.types.Operator):
+ '''Select object relative to the active objects position in the hierarchy'''
+ bl_idname = "object.select_hierarchy"
+ bl_label = "Select Hierarchy"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ direction = EnumProperty(items=(
+ ('PARENT', "Parent", ""),
+ ('CHILD', "Child", "")),
+ name="Direction",
+ description="Direction to select in the hierarchy",
+ default='PARENT')
+
+ extend = BoolProperty(name="Extend", description="Extend the existing selection", default=False)
+
+ @classmethod
+ def poll(cls, context):
+ return context.object
+
+ def execute(self, context):
+ select_new = []
+ act_new = None
+
+ selected_objects = context.selected_objects
+ obj_act = context.object
+
+ if context.object not in selected_objects:
+ selected_objects.append(context.object)
+
+ if self.direction == 'PARENT':
+ for obj in selected_objects:
+ parent = obj.parent
+
+ if parent:
+ if obj_act == obj:
+ act_new = parent
+
+ select_new.append(parent)
+
+ else:
+ for obj in selected_objects:
+ select_new.extend(obj.children)
+
+ if select_new:
+ select_new.sort(key=lambda obj_iter: obj_iter.name)
+ act_new = select_new[0]
+
+ # dont edit any object settings above this
+ if select_new:
+ if not self.extend:
+ bpy.ops.object.select_all(action='DESELECT')
+
+ for obj in select_new:
+ obj.select = True
+
+ context.scene.objects.active = act_new
+ return {'FINISHED'}
+
+ return {'CANCELLED'}
+
+
+class SubdivisionSet(bpy.types.Operator):
+ '''Sets a Subdivision Surface Level (1-5)'''
+
+ bl_idname = "object.subdivision_set"
+ bl_label = "Subdivision Set"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ level = IntProperty(name="Level",
+ default=1, min=-100, max=100, soft_min=-6, soft_max=6)
+
+ relative = BoolProperty(name="Relative", description="Apply the subsurf level as an offset relative to the current level", default=False)
+
+ @classmethod
+ def poll(cls, context):
+ obs = context.selected_editable_objects
+ return (obs is not None)
+
+ def execute(self, context):
+ level = self.level
+ relative = self.relative
+
+ if relative and level == 0:
+ return {'CANCELLED'} # nothing to do
+
+ def set_object_subd(obj):
+ for mod in obj.modifiers:
+ if mod.type == 'MULTIRES':
+ if not relative:
+ if level <= mod.total_levels:
+ if obj.mode == 'SCULPT':
+ if mod.sculpt_levels != level:
+ mod.sculpt_levels = level
+ elif obj.mode == 'OBJECT':
+ if mod.levels != level:
+ mod.levels = level
+ return
+ else:
+ if obj.mode == 'SCULPT':
+ if mod.sculpt_levels + level <= mod.total_levels:
+ mod.sculpt_levels += level
+ elif obj.mode == 'OBJECT':
+ if mod.levels + level <= mod.total_levels:
+ mod.levels += level
+ return
+
+ elif mod.type == 'SUBSURF':
+ if relative:
+ mod.levels += level
+ else:
+ if mod.levels != level:
+ mod.levels = level
+
+ return
+
+ # add a new modifier
+ try:
+ mod = obj.modifiers.new("Subsurf", 'SUBSURF')
+ mod.levels = level
+ except:
+ self.report({'WARNING'}, "Modifiers cannot be added to object: " + obj.name)
+
+ for obj in context.selected_editable_objects:
+ set_object_subd(obj)
+
+ return {'FINISHED'}
+
+
+class ShapeTransfer(bpy.types.Operator):
+ '''Copy another selected objects active shape to this one by applying the relative offsets'''
+
+ bl_idname = "object.shape_key_transfer"
+ bl_label = "Transfer Shape Key"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ mode = EnumProperty(items=(
+ ('OFFSET', "Offset", "Apply the relative positional offset"),
+ ('RELATIVE_FACE', "Relative Face", "Calculate the geometricly relative position (using faces)."),
+ ('RELATIVE_EDGE', "Relative Edge", "Calculate the geometricly relative position (using edges).")),
+ name="Transformation Mode",
+ description="Method to apply relative shape positions to the new shape",
+ default='OFFSET')
+
+ use_clamp = BoolProperty(name="Clamp Offset",
+ description="Clamp the transformation to the distance each vertex moves in the original shape.",
+ default=False)
+
+ def _main(self, ob_act, objects, mode='OFFSET', use_clamp=False):
+
+ def me_nos(verts):
+ return [v.normal.copy() for v in verts]
+
+ def me_cos(verts):
+ return [v.co.copy() for v in verts]
+
+ def ob_add_shape(ob, name):
+ me = ob.data
+ key = ob.shape_key_add(from_mix=False)
+ if len(me.shape_keys.keys) == 1:
+ key.name = "Basis"
+ key = ob.shape_key_add(from_mix=False) # we need a rest
+ key.name = name
+ ob.active_shape_key_index = len(me.shape_keys.keys) - 1
+ ob.show_only_shape_key = True
+
+ from mathutils.geometry import barycentric_transform
+ from mathutils import Vector
+
+ if use_clamp and mode == 'OFFSET':
+ use_clamp = False
+
+ me = ob_act.data
+ orig_key_name = ob_act.active_shape_key.name
+
+ orig_shape_coords = me_cos(ob_act.active_shape_key.data)
+
+ orig_normals = me_nos(me.vertices)
+ # orig_coords = me_cos(me.vertices) # the actual mverts location isnt as relyable as the base shape :S
+ orig_coords = me_cos(me.shape_keys.keys[0].data)
+
+ for ob_other in objects:
+ me_other = ob_other.data
+ if len(me_other.vertices) != len(me.vertices):
+ self.report({'WARNING'}, "Skipping '%s', vertex count differs" % ob_other.name)
+ continue
+
+ target_normals = me_nos(me_other.vertices)
+ if me_other.shape_keys:
+ target_coords = me_cos(me_other.shape_keys.keys[0].data)
+ else:
+ target_coords = me_cos(me_other.vertices)
+
+ ob_add_shape(ob_other, orig_key_name)
+
+ # editing the final coords, only list that stores wrapped coords
+ target_shape_coords = [v.co for v in ob_other.active_shape_key.data]
+
+ median_coords = [[] for i in range(len(me.vertices))]
+
+ # Method 1, edge
+ if mode == 'OFFSET':
+ for i, vert_cos in enumerate(median_coords):
+ vert_cos.append(target_coords[i] + (orig_shape_coords[i] - orig_coords[i]))
+
+ elif mode == 'RELATIVE_FACE':
+ for face in me.faces:
+ i1, i2, i3, i4 = face.vertices_raw
+ if i4 != 0:
+ pt = barycentric_transform(orig_shape_coords[i1],
+ orig_coords[i4], orig_coords[i1], orig_coords[i2],
+ target_coords[i4], target_coords[i1], target_coords[i2])
+ median_coords[i1].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i2],
+ orig_coords[i1], orig_coords[i2], orig_coords[i3],
+ target_coords[i1], target_coords[i2], target_coords[i3])
+ median_coords[i2].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i3],
+ orig_coords[i2], orig_coords[i3], orig_coords[i4],
+ target_coords[i2], target_coords[i3], target_coords[i4])
+ median_coords[i3].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i4],
+ orig_coords[i3], orig_coords[i4], orig_coords[i1],
+ target_coords[i3], target_coords[i4], target_coords[i1])
+ median_coords[i4].append(pt)
+
+ else:
+ pt = barycentric_transform(orig_shape_coords[i1],
+ orig_coords[i3], orig_coords[i1], orig_coords[i2],
+ target_coords[i3], target_coords[i1], target_coords[i2])
+ median_coords[i1].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i2],
+ orig_coords[i1], orig_coords[i2], orig_coords[i3],
+ target_coords[i1], target_coords[i2], target_coords[i3])
+ median_coords[i2].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i3],
+ orig_coords[i2], orig_coords[i3], orig_coords[i1],
+ target_coords[i2], target_coords[i3], target_coords[i1])
+ median_coords[i3].append(pt)
+
+ elif mode == 'RELATIVE_EDGE':
+ for ed in me.edges:
+ i1, i2 = ed.vertices
+ v1, v2 = orig_coords[i1], orig_coords[i2]
+ edge_length = (v1 - v2).length
+ n1loc = v1 + orig_normals[i1] * edge_length
+ n2loc = v2 + orig_normals[i2] * edge_length
+
+ # now get the target nloc's
+ v1_to, v2_to = target_coords[i1], target_coords[i2]
+ edlen_to = (v1_to - v2_to).length
+ n1loc_to = v1_to + target_normals[i1] * edlen_to
+ n2loc_to = v2_to + target_normals[i2] * edlen_to
+
+ pt = barycentric_transform(orig_shape_coords[i1],
+ v2, v1, n1loc,
+ v2_to, v1_to, n1loc_to)
+ median_coords[i1].append(pt)
+
+ pt = barycentric_transform(orig_shape_coords[i2],
+ v1, v2, n2loc,
+ v1_to, v2_to, n2loc_to)
+ median_coords[i2].append(pt)
+
+ # apply the offsets to the new shape
+ from functools import reduce
+ VectorAdd = Vector.__add__
+
+ for i, vert_cos in enumerate(median_coords):
+ if vert_cos:
+ co = reduce(VectorAdd, vert_cos) / len(vert_cos)
+
+ if use_clamp:
+ # clamp to the same movement as the original
+ # breaks copy between different scaled meshes.
+ len_from = (orig_shape_coords[i] - orig_coords[i]).length
+ ofs = co - target_coords[i]
+ ofs.length = len_from
+ co = target_coords[i] + ofs
+
+ target_shape_coords[i][:] = co
+
+ return {'FINISHED'}
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return (obj and obj.mode != 'EDIT')
+
+ def execute(self, context):
+ C = bpy.context
+ ob_act = C.active_object
+ objects = [ob for ob in C.selected_editable_objects if ob != ob_act]
+
+ if 1: # swap from/to, means we cant copy to many at once.
+ if len(objects) != 1:
+ self.report({'ERROR'}, "Expected one other selected mesh object to copy from")
+ return {'CANCELLED'}
+ ob_act, objects = objects[0], [ob_act]
+
+ if ob_act.type != 'MESH':
+ self.report({'ERROR'}, "Other object is not a mesh.")
+ return {'CANCELLED'}
+
+ if ob_act.active_shape_key is None:
+ self.report({'ERROR'}, "Other object has no shape key")
+ return {'CANCELLED'}
+ return self._main(ob_act, objects, self.mode, self.use_clamp)
+
+
+class JoinUVs(bpy.types.Operator):
+ '''Copy UV Layout to objects with matching geometry'''
+ bl_idname = "object.join_uvs"
+ bl_label = "Join as UVs"
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return (obj and obj.type == 'MESH')
+
+ def _main(self, context):
+ import array
+ obj = context.active_object
+ mesh = obj.data
+
+ is_editmode = (obj.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+ if not mesh.uv_textures:
+ self.report({'WARNING'}, "Object: %s, Mesh: '%s' has no UVs\n" % (obj.name, mesh.name))
+ else:
+ len_faces = len(mesh.faces)
+
+ uv_array = array.array('f', [0.0] * 8) * len_faces # seems to be the fastest way to create an array
+ mesh.uv_textures.active.data.foreach_get("uv_raw", uv_array)
+
+ objects = context.selected_editable_objects[:]
+
+ for obj_other in objects:
+ if obj_other.type == 'MESH':
+ obj_other.data.tag = False
+
+ for obj_other in objects:
+ if obj_other != obj and obj_other.type == 'MESH':
+ mesh_other = obj_other.data
+ if mesh_other != mesh:
+ if mesh_other.tag == False:
+ mesh_other.tag = True
+
+ if len(mesh_other.faces) != len_faces:
+ self.report({'WARNING'}, "Object: %s, Mesh: '%s' has %d faces, expected %d\n" % (obj_other.name, mesh_other.name, len(mesh_other.faces), len_faces))
+ else:
+ uv_other = mesh_other.uv_textures.active
+ if not uv_other:
+ uv_other = mesh_other.uv_textures.new() # should return the texture it adds
+
+ # finally do the copy
+ uv_other.data.foreach_set("uv_raw", uv_array)
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
+ def execute(self, context):
+ self._main(context)
+ return {'FINISHED'}
+
+
+class MakeDupliFace(bpy.types.Operator):
+ '''Make linked objects into dupli-faces'''
+ bl_idname = "object.make_dupli_face"
+ bl_label = "Make Dupli-Face"
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return (obj and obj.type == 'MESH')
+
+ def _main(self, context):
+ from mathutils import Vector
+
+ SCALE_FAC = 0.01
+ offset = 0.5 * SCALE_FAC
+ base_tri = Vector((-offset, -offset, 0.0)), Vector((offset, -offset, 0.0)), Vector((offset, offset, 0.0)), Vector((-offset, offset, 0.0))
+
+ def matrix_to_quat(matrix):
+ # scale = matrix.median_scale
+ trans = matrix.to_translation()
+ rot = matrix.to_3x3() # also contains scale
+
+ return [(b * rot) + trans for b in base_tri]
+ scene = bpy.context.scene
+ linked = {}
+ for obj in bpy.context.selected_objects:
+ data = obj.data
+ if data:
+ linked.setdefault(data, []).append(obj)
+
+ for data, objects in linked.items():
+ face_verts = [axis for obj in objects for v in matrix_to_quat(obj.matrix_world) for axis in v]
+ faces = list(range(len(face_verts) // 3))
+
+ mesh = bpy.data.meshes.new(data.name + "_dupli")
+
+ mesh.vertices.add(len(face_verts) // 3)
+ mesh.faces.add(len(face_verts) // 12)
+
+ mesh.vertices.foreach_set("co", face_verts)
+ mesh.faces.foreach_set("vertices_raw", faces)
+ mesh.update() # generates edge data
+
+ # pick an object to use
+ obj = objects[0]
+
+ ob_new = bpy.data.objects.new(mesh.name, mesh)
+ base = scene.objects.link(ob_new)
+ base.layers[:] = obj.layers
+
+ ob_inst = bpy.data.objects.new(data.name, data)
+ base = scene.objects.link(ob_inst)
+ base.layers[:] = obj.layers
+
+ for obj in objects:
+ scene.objects.unlink(obj)
+
+ ob_new.dupli_type = 'FACES'
+ ob_inst.parent = ob_new
+ ob_new.use_dupli_faces_scale = True
+ ob_new.dupli_faces_scale = 1.0 / SCALE_FAC
+
+ def execute(self, context):
+ self._main(context)
+ return {'FINISHED'}
+
+
+class IsolateTypeRender(bpy.types.Operator):
+ '''Hide unselected render objects of same type as active by setting the hide render flag'''
+ bl_idname = "object.isolate_type_render"
+ bl_label = "Restrict Render Unselected"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ act_type = context.object.type
+
+ for obj in context.visible_objects:
+
+ if obj.select:
+ obj.hide_render = False
+ else:
+ if obj.type == act_type:
+ obj.hide_render = True
+
+ return {'FINISHED'}
+
+
+class ClearAllRestrictRender(bpy.types.Operator):
+ '''Reveal all render objects by setting the hide render flag'''
+ bl_idname = "object.hide_render_clear_all"
+ bl_label = "Clear All Restrict Render"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ def execute(self, context):
+ for obj in context.scene.objects:
+ obj.hide_render = False
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/object_align.py b/release/scripts/startup/bl_operators/object_align.py
new file mode 100644
index 00000000000..644f30a4745
--- /dev/null
+++ b/release/scripts/startup/bl_operators/object_align.py
@@ -0,0 +1,280 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from mathutils import Vector
+
+
+def align_objects(align_x, align_y, align_z, align_mode, relative_to):
+
+ cursor = bpy.context.scene.cursor_location
+
+ Left_Up_Front_SEL = [0.0, 0.0, 0.0]
+ Right_Down_Back_SEL = [0.0, 0.0, 0.0]
+
+ flag_first = True
+
+ objs = []
+
+ for obj in bpy.context.selected_objects:
+ matrix_world = obj.matrix_world
+ bb_world = [Vector(v[:]) * matrix_world for v in obj.bound_box]
+ objs.append((obj, bb_world))
+
+ if not objs:
+ return False
+
+ for obj, bb_world in objs:
+ Left_Up_Front = bb_world[1]
+ Right_Down_Back = bb_world[7]
+
+ # Active Center
+
+ if obj == bpy.context.active_object:
+
+ center_active_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0
+ center_active_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0
+ center_active_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0
+
+ size_active_x = (Right_Down_Back[0] - Left_Up_Front[0]) / 2.0
+ size_active_y = (Right_Down_Back[1] - Left_Up_Front[1]) / 2.0
+ size_active_z = (Left_Up_Front[2] - Right_Down_Back[2]) / 2.0
+
+ # Selection Center
+
+ if flag_first:
+ flag_first = False
+
+ Left_Up_Front_SEL[0] = Left_Up_Front[0]
+ Left_Up_Front_SEL[1] = Left_Up_Front[1]
+ Left_Up_Front_SEL[2] = Left_Up_Front[2]
+
+ Right_Down_Back_SEL[0] = Right_Down_Back[0]
+ Right_Down_Back_SEL[1] = Right_Down_Back[1]
+ Right_Down_Back_SEL[2] = Right_Down_Back[2]
+
+ else:
+ # X axis
+ if Left_Up_Front[0] < Left_Up_Front_SEL[0]:
+ Left_Up_Front_SEL[0] = Left_Up_Front[0]
+ # Y axis
+ if Left_Up_Front[1] < Left_Up_Front_SEL[1]:
+ Left_Up_Front_SEL[1] = Left_Up_Front[1]
+ # Z axis
+ if Left_Up_Front[2] > Left_Up_Front_SEL[2]:
+ Left_Up_Front_SEL[2] = Left_Up_Front[2]
+
+ # X axis
+ if Right_Down_Back[0] > Right_Down_Back_SEL[0]:
+ Right_Down_Back_SEL[0] = Right_Down_Back[0]
+ # Y axis
+ if Right_Down_Back[1] > Right_Down_Back_SEL[1]:
+ Right_Down_Back_SEL[1] = Right_Down_Back[1]
+ # Z axis
+ if Right_Down_Back[2] < Right_Down_Back_SEL[2]:
+ Right_Down_Back_SEL[2] = Right_Down_Back[2]
+
+ center_sel_x = (Left_Up_Front_SEL[0] + Right_Down_Back_SEL[0]) / 2.0
+ center_sel_y = (Left_Up_Front_SEL[1] + Right_Down_Back_SEL[1]) / 2.0
+ center_sel_z = (Left_Up_Front_SEL[2] + Right_Down_Back_SEL[2]) / 2.0
+
+ # Main Loop
+
+ for obj, bb_world in objs:
+
+ loc_world = obj.location
+ bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
+
+ Left_Up_Front = bb_world[1]
+ Right_Down_Back = bb_world[7]
+
+ center_x = (Left_Up_Front[0] + Right_Down_Back[0]) / 2.0
+ center_y = (Left_Up_Front[1] + Right_Down_Back[1]) / 2.0
+ center_z = (Left_Up_Front[2] + Right_Down_Back[2]) / 2.0
+
+ positive_x = Right_Down_Back[0]
+ positive_y = Right_Down_Back[1]
+ positive_z = Left_Up_Front[2]
+
+ negative_x = Left_Up_Front[0]
+ negative_y = Left_Up_Front[1]
+ negative_z = Right_Down_Back[2]
+
+ obj_loc = obj.location
+
+ if align_x:
+
+ # Align Mode
+
+ if relative_to == 'OPT_4': # Active relative
+ if align_mode == 'OPT_1':
+ obj_x = obj_loc[0] - negative_x - size_active_x
+
+ elif align_mode == 'OPT_3':
+ obj_x = obj_loc[0] - positive_x + size_active_x
+
+ else: # Everything else relative
+ if align_mode == 'OPT_1':
+ obj_x = obj_loc[0] - negative_x
+
+ elif align_mode == 'OPT_3':
+ obj_x = obj_loc[0] - positive_x
+
+ if align_mode == 'OPT_2': # All relative
+ obj_x = obj_loc[0] - center_x
+
+ # Relative To
+
+ if relative_to == 'OPT_1':
+ loc_x = obj_x
+
+ elif relative_to == 'OPT_2':
+ loc_x = obj_x + cursor[0]
+
+ elif relative_to == 'OPT_3':
+ loc_x = obj_x + center_sel_x
+
+ elif relative_to == 'OPT_4':
+ loc_x = obj_x + center_active_x
+
+ obj.location[0] = loc_x
+
+ if align_y:
+ # Align Mode
+
+ if relative_to == 'OPT_4': # Active relative
+ if align_mode == 'OPT_1':
+ obj_y = obj_loc[1] - negative_y - size_active_y
+
+ elif align_mode == 'OPT_3':
+ obj_y = obj_loc[1] - positive_y + size_active_y
+
+ else: # Everything else relative
+ if align_mode == 'OPT_1':
+ obj_y = obj_loc[1] - negative_y
+
+ elif align_mode == 'OPT_3':
+ obj_y = obj_loc[1] - positive_y
+
+ if align_mode == 'OPT_2': # All relative
+ obj_y = obj_loc[1] - center_y
+
+ # Relative To
+
+ if relative_to == 'OPT_1':
+ loc_y = obj_y
+
+ elif relative_to == 'OPT_2':
+ loc_y = obj_y + cursor[1]
+
+ elif relative_to == 'OPT_3':
+ loc_y = obj_y + center_sel_y
+
+ elif relative_to == 'OPT_4':
+ loc_y = obj_y + center_active_y
+
+ obj.location[1] = loc_y
+
+ if align_z:
+ # Align Mode
+ if relative_to == 'OPT_4': # Active relative
+ if align_mode == 'OPT_1':
+ obj_z = obj_loc[2] - negative_z - size_active_z
+
+ elif align_mode == 'OPT_3':
+ obj_z = obj_loc[2] - positive_z + size_active_z
+
+ else: # Everything else relative
+ if align_mode == 'OPT_1':
+ obj_z = obj_loc[2] - negative_z
+
+ elif align_mode == 'OPT_3':
+ obj_z = obj_loc[2] - positive_z
+
+ if align_mode == 'OPT_2': # All relative
+ obj_z = obj_loc[2] - center_z
+
+ # Relative To
+
+ if relative_to == 'OPT_1':
+ loc_z = obj_z
+
+ elif relative_to == 'OPT_2':
+ loc_z = obj_z + cursor[2]
+
+ elif relative_to == 'OPT_3':
+ loc_z = obj_z + center_sel_z
+
+ elif relative_to == 'OPT_4':
+ loc_z = obj_z + center_active_z
+
+ obj.location[2] = loc_z
+
+ return True
+
+
+from bpy.props import EnumProperty
+
+
+class AlignObjects(bpy.types.Operator):
+ '''Align Objects'''
+ bl_idname = "object.align"
+ bl_label = "Align Objects"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ align_mode = EnumProperty(items=(
+ ('OPT_1', "Negative Sides", ""),
+ ('OPT_2', "Centers", ""),
+ ('OPT_3', "Positive Sides", "")),
+ name="Align Mode:",
+ description="",
+ default='OPT_2')
+
+ relative_to = EnumProperty(items=(
+ ('OPT_1', "Scene Origin", ""),
+ ('OPT_2', "3D Cursor", ""),
+ ('OPT_3', "Selection", ""),
+ ('OPT_4', "Active", "")),
+ name="Relative To:",
+ description="",
+ default='OPT_4')
+
+ align_axis = EnumProperty(items=(
+ ('X', "X", ""),
+ ('Y', "Y", ""),
+ ('Z', "Z", ""),
+ ),
+ name="Align",
+ description="Align to axis",
+ options={'ENUM_FLAG'})
+
+ @classmethod
+ def poll(cls, context):
+ return context.mode == 'OBJECT'
+
+ def execute(self, context):
+ align_axis = self.align_axis
+ ret = align_objects('X' in align_axis, 'Y' in align_axis, 'Z' in align_axis, self.align_mode, self.relative_to)
+
+ if not ret:
+ self.report({'WARNING'}, "No objects with bound-box selected")
+ return {'CANCELLED'}
+ else:
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/object_randomize_transform.py b/release/scripts/startup/bl_operators/object_randomize_transform.py
new file mode 100644
index 00000000000..d72c600ef78
--- /dev/null
+++ b/release/scripts/startup/bl_operators/object_randomize_transform.py
@@ -0,0 +1,147 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+def randomize_selected(seed, delta, loc, rot, scale, scale_even):
+
+ import random
+ from random import uniform
+ from mathutils import Vector
+
+ random.seed(seed)
+
+ def rand_vec(vec_range):
+ return Vector(uniform(-val, val) for val in vec_range)
+
+ for obj in bpy.context.selected_objects:
+
+ if loc:
+ if delta:
+ obj.delta_location += rand_vec(loc)
+ else:
+ obj.location += rand_vec(loc)
+ else: # otherwise the values change under us
+ uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
+
+ if rot: # TODO, non euler's
+ vec = rand_vec(rot)
+ if delta:
+ obj.delta_rotation_euler[0] += vec[0]
+ obj.delta_rotation_euler[1] += vec[1]
+ obj.delta_rotation_euler[2] += vec[2]
+ else:
+ obj.rotation_euler[0] += vec[0]
+ obj.rotation_euler[1] += vec[1]
+ obj.rotation_euler[2] += vec[2]
+ else:
+ uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
+
+ if scale:
+ if delta:
+ org_sca_x, org_sca_y, org_sca_z = obj.delta_scale
+ else:
+ org_sca_x, org_sca_y, org_sca_z = obj.scale
+
+ if scale_even:
+ sca_x = sca_y = sca_z = uniform(scale[0], - scale[0])
+ uniform(0.0, 0.0), uniform(0.0, 0.0)
+ else:
+ sca_x, sca_y, sca_z = rand_vec(scale)
+
+ if scale_even:
+ aX = -(sca_x * org_sca_x) + org_sca_x
+ aY = -(sca_x * org_sca_y) + org_sca_y
+ aZ = -(sca_x * org_sca_z) + org_sca_z
+ else:
+ aX = sca_x + org_sca_x
+ aY = sca_y + org_sca_y
+ aZ = sca_z + org_sca_z
+
+ if delta:
+ obj.delta_scale = aX, aY, aZ
+ else:
+ obj.scale = aX, aY, aZ
+ else:
+ uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
+
+
+from bpy.props import IntProperty, BoolProperty, FloatProperty, FloatVectorProperty
+
+
+class RandomizeLocRotSize(bpy.types.Operator):
+ '''Randomize objects loc/rot/scale'''
+ bl_idname = "object.randomize_transform"
+ bl_label = "Randomize Transform"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ random_seed = IntProperty(name="Random Seed",
+ description="Seed value for the random generator",
+ default=0, min=0, max=1000)
+
+ use_delta = BoolProperty(name="Transform Delta",
+ description="Randomize delta transform values instead of regular transform", default=False)
+
+ use_loc = BoolProperty(name="Randomize Location",
+ description="Randomize the location values", default=True)
+
+ loc = FloatVectorProperty(name="Location",
+ description="Maximun distance the objects can spread over each axis",
+ default=(0.0, 0.0, 0.0), min=-100.0, max=100.0, subtype='TRANSLATION')
+
+ use_rot = BoolProperty(name="Randomize Rotation",
+ description="Randomize the rotation values", default=True)
+
+ rot = FloatVectorProperty(name="Rotation",
+ description="Maximun rotation over each axis",
+ default=(0.0, 0.0, 0.0), min=-180.0, max=180.0, subtype='TRANSLATION')
+
+ use_scale = BoolProperty(name="Randomize Scale",
+ description="Randomize the scale values", default=True)
+
+ scale_even = BoolProperty(name="Scale Even",
+ description="Use the same scale value for all axis", default=False)
+
+ '''scale_min = FloatProperty(name="Minimun Scale Factor",
+ description="Lowest scale percentage possible",
+ default=0.15, min=-1.0, max=1.0, precision=3)'''
+
+ scale = FloatVectorProperty(name="Scale",
+ description="Maximum scale randomization over each axis",
+ default=(0.0, 0.0, 0.0), min=-100.0, max=100.0, subtype='TRANSLATION')
+
+ def execute(self, context):
+ from math import radians
+
+ seed = self.random_seed
+
+ delta = self.use_delta
+
+ loc = None if not self.use_loc else self.loc
+ rot = None if not self.use_rot else self.rot * radians(1.0)
+ scale = None if not self.use_scale else self.scale
+
+ scale_even = self.scale_even
+ #scale_min = self.scale_min
+
+ randomize_selected(seed, delta, loc, rot, scale, scale_even)
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
new file mode 100644
index 00000000000..e6f71ef9573
--- /dev/null
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -0,0 +1,353 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+import os
+
+
+class AddPresetBase():
+ '''Base preset class, only for subclassing
+ subclasses must define
+ - preset_values
+ - preset_subdir '''
+ # bl_idname = "script.preset_base_add"
+ # bl_label = "Add a Python Preset"
+ bl_options = {'REGISTER'} # only because invoke_props_popup requires.
+
+ name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="")
+ remove_active = bpy.props.BoolProperty(default=False, options={'HIDDEN'})
+
+ @staticmethod
+ def as_filename(name): # could reuse for other presets
+ for char in " !@#$%^&*(){}:\";'[]<>,.\\/?":
+ name = name.replace(char, '_')
+ return name.lower().strip()
+
+ def execute(self, context):
+ import os
+
+ if hasattr(self, "pre_cb"):
+ self.pre_cb(context)
+
+ preset_menu_class = getattr(bpy.types, self.preset_menu)
+
+ if not self.remove_active:
+
+ if not self.name:
+ return {'FINISHED'}
+
+ filename = self.as_filename(self.name)
+
+ target_path = bpy.utils.user_resource('SCRIPTS', os.path.join("presets", self.preset_subdir), create=True)
+
+ if not target_path:
+ self.report({'WARNING'}, "Failed to create presets path")
+ return {'CANCELLED'}
+
+ filepath = os.path.join(target_path, filename) + ".py"
+
+ if hasattr(self, "add"):
+ self.add(context, filepath)
+ else:
+ file_preset = open(filepath, 'w')
+ file_preset.write("import bpy\n")
+
+ if hasattr(self, "preset_defines"):
+ for rna_path in self.preset_defines:
+ exec(rna_path)
+ file_preset.write("%s\n" % rna_path)
+ file_preset.write("\n")
+
+ for rna_path in self.preset_values:
+ value = eval(rna_path)
+ # convert thin wrapped sequences to simple lists to repr()
+ try:
+ value = value[:]
+ except:
+ pass
+
+ file_preset.write("%s = %r\n" % (rna_path, value))
+
+ file_preset.close()
+
+ preset_menu_class.bl_label = bpy.path.display_name(filename)
+
+ else:
+ preset_active = preset_menu_class.bl_label
+
+ # fairly sloppy but convenient.
+ filepath = bpy.utils.preset_find(preset_active, self.preset_subdir)
+
+ if not filepath:
+ filepath = bpy.utils.preset_find(preset_active, self.preset_subdir, display_name=True)
+
+ if not filepath:
+ return {'CANCELLED'}
+
+ if hasattr(self, "remove"):
+ self.remove(context, filepath)
+ else:
+ try:
+ os.remove(filepath)
+ except:
+ import traceback
+ traceback.print_exc()
+
+ # XXX, stupid!
+ preset_menu_class.bl_label = "Presets"
+
+ if hasattr(self, "post_cb"):
+ self.post_cb(context)
+
+ return {'FINISHED'}
+
+ def check(self, context):
+ self.name = self.as_filename(self.name)
+
+ def invoke(self, context, event):
+ if not self.remove_active:
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
+ else:
+ return self.execute(context)
+
+
+class ExecutePreset(bpy.types.Operator):
+ ''' Executes a preset '''
+ bl_idname = "script.execute_preset"
+ bl_label = "Execute a Python Preset"
+
+ filepath = bpy.props.StringProperty(name="Path", description="Path of the Python file to execute", maxlen=512, default="")
+ menu_idname = bpy.props.StringProperty(name="Menu ID Name", description="ID name of the menu this was called from", default="")
+
+ def execute(self, context):
+ from os.path import basename
+ filepath = self.filepath
+
+ # change the menu title to the most recently chosen option
+ preset_class = getattr(bpy.types, self.menu_idname)
+ preset_class.bl_label = bpy.path.display_name(basename(filepath))
+
+ # execute the preset using script.python_file_run
+ bpy.ops.script.python_file_run(filepath=filepath)
+ return {'FINISHED'}
+
+
+class AddPresetRender(AddPresetBase, bpy.types.Operator):
+ '''Add a Render Preset'''
+ bl_idname = "render.preset_add"
+ bl_label = "Add Render Preset"
+ preset_menu = "RENDER_MT_presets"
+
+ preset_defines = [
+ "scene = bpy.context.scene"
+ ]
+
+ preset_values = [
+ "scene.render.field_order",
+ "scene.render.fps",
+ "scene.render.fps_base",
+ "scene.render.pixel_aspect_x",
+ "scene.render.pixel_aspect_y",
+ "scene.render.resolution_percentage",
+ "scene.render.resolution_x",
+ "scene.render.resolution_y",
+ "scene.render.use_fields",
+ "scene.render.use_fields_still",
+ ]
+
+ preset_subdir = "render"
+
+
+class AddPresetSSS(AddPresetBase, bpy.types.Operator):
+ '''Add a Subsurface Scattering Preset'''
+ bl_idname = "material.sss_preset_add"
+ bl_label = "Add SSS Preset"
+ preset_menu = "MATERIAL_MT_sss_presets"
+
+ preset_defines = [
+ "material = (bpy.context.material.active_node_material if bpy.context.material.active_node_material else bpy.context.material)"
+ ]
+
+ preset_values = [
+ "material.subsurface_scattering.back",
+ "material.subsurface_scattering.color",
+ "material.subsurface_scattering.color_factor",
+ "material.subsurface_scattering.error_threshold",
+ "material.subsurface_scattering.front",
+ "material.subsurface_scattering.ior",
+ "material.subsurface_scattering.radius",
+ "material.subsurface_scattering.scale",
+ "material.subsurface_scattering.texture_factor",
+ ]
+
+ preset_subdir = "sss"
+
+
+class AddPresetCloth(AddPresetBase, bpy.types.Operator):
+ '''Add a Cloth Preset'''
+ bl_idname = "cloth.preset_add"
+ bl_label = "Add Cloth Preset"
+ preset_menu = "CLOTH_MT_presets"
+
+ preset_defines = [
+ "cloth = bpy.context.cloth"
+ ]
+
+ preset_values = [
+ "cloth.settings.air_damping",
+ "cloth.settings.bending_stiffness",
+ "cloth.settings.mass",
+ "cloth.settings.quality",
+ "cloth.settings.spring_damping",
+ "cloth.settings.structural_stiffness",
+ ]
+
+ preset_subdir = "cloth"
+
+
+class AddPresetSunSky(AddPresetBase, bpy.types.Operator):
+ '''Add a Sky & Atmosphere Preset'''
+ bl_idname = "lamp.sunsky_preset_add"
+ bl_label = "Add Sunsky Preset"
+ preset_menu = "LAMP_MT_sunsky_presets"
+
+ preset_defines = [
+ "sky = bpy.context.object.data.sky"
+ ]
+
+ preset_values = [
+ "sky.atmosphere_extinction",
+ "sky.atmosphere_inscattering",
+ "sky.atmosphere_turbidity",
+ "sky.backscattered_light",
+ "sky.horizon_brightness",
+ "sky.spread",
+ "sky.sun_brightness",
+ "sky.sun_intensity",
+ "sky.sun_size",
+ "sky.use_sky_blend",
+ "sky.use_sky_blend_type",
+ "sky.use_sky_color_space",
+ "sky.use_sky_exposure",
+ ]
+
+ preset_subdir = "sunsky"
+
+
+class AddPresetInteraction(AddPresetBase, bpy.types.Operator):
+ '''Add an Application Interaction Preset'''
+ bl_idname = "wm.interaction_preset_add"
+ bl_label = "Add Interaction Preset"
+ preset_menu = "USERPREF_MT_interaction_presets"
+
+ preset_defines = [
+ "user_preferences = bpy.context.user_preferences"
+ ]
+
+ preset_values = [
+ "user_preferences.edit.use_drag_immediately",
+ "user_preferences.edit.use_insertkey_xyz_to_rgb",
+ "user_preferences.inputs.invert_mouse_wheel_zoom",
+ "user_preferences.inputs.select_mouse",
+ "user_preferences.inputs.use_emulate_numpad",
+ "user_preferences.inputs.use_mouse_continuous",
+ "user_preferences.inputs.use_mouse_emulate_3_button",
+ "user_preferences.inputs.view_rotate_method",
+ "user_preferences.inputs.view_zoom_axis",
+ "user_preferences.inputs.view_zoom_method",
+ ]
+
+ preset_subdir = "interaction"
+
+
+class AddPresetKeyconfig(AddPresetBase, bpy.types.Operator):
+ '''Add a Keyconfig Preset'''
+ bl_idname = "wm.keyconfig_preset_add"
+ bl_label = "Add Keyconfig Preset"
+ preset_menu = "USERPREF_MT_keyconfigs"
+ preset_subdir = "keyconfig"
+
+ def add(self, context, filepath):
+ bpy.ops.wm.keyconfig_export(filepath=filepath)
+ bpy.utils.keyconfig_set(filepath)
+
+ def pre_cb(self, context):
+ keyconfigs = bpy.context.window_manager.keyconfigs
+ if self.remove_active:
+ preset_menu_class = getattr(bpy.types, self.preset_menu)
+ preset_menu_class.bl_label = keyconfigs.active.name
+
+ def post_cb(self, context):
+ keyconfigs = bpy.context.window_manager.keyconfigs
+ if self.remove_active:
+ keyconfigs.remove(keyconfigs.active)
+
+
+class AddPresetOperator(AddPresetBase, bpy.types.Operator):
+ '''Add an Application Interaction Preset'''
+ bl_idname = "wm.operator_preset_add"
+ bl_label = "Operator Preset"
+ preset_menu = "WM_MT_operator_presets"
+
+ operator = bpy.props.StringProperty(name="Operator", maxlen=64, options={'HIDDEN'})
+
+ # XXX, not ideal
+ preset_defines = [
+ "op = bpy.context.space_data.operator",
+ ]
+
+ @property
+ def preset_subdir(self):
+ return __class__.operator_path(self.operator)
+
+ @property
+ def preset_values(self):
+ properties_blacklist = bpy.types.Operator.bl_rna.properties.keys()
+
+ prefix, suffix = self.operator.split("_OT_", 1)
+ operator_rna = getattr(getattr(bpy.ops, prefix.lower()), suffix).get_rna().bl_rna
+
+ ret = []
+ for prop_id, prop in operator_rna.properties.items():
+ if (not prop.is_hidden) and prop_id not in properties_blacklist:
+ ret.append("op.%s" % prop_id)
+
+ return ret
+
+ @staticmethod
+ def operator_path(operator):
+ import os
+ prefix, suffix = operator.split("_OT_", 1)
+ return os.path.join("operator", "%s.%s" % (prefix.lower(), suffix))
+
+
+class WM_MT_operator_presets(bpy.types.Menu):
+ bl_label = "Operator Presets"
+
+ def draw(self, context):
+ self.operator = context.space_data.operator.bl_idname
+ bpy.types.Menu.draw_preset(self, context)
+
+ @property
+ def preset_subdir(self):
+ return AddPresetOperator.operator_path(self.operator)
+
+ preset_operator = "script.execute_preset"
diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
new file mode 100644
index 00000000000..64af25e7b0f
--- /dev/null
+++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py
@@ -0,0 +1,142 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# Script copyright (C) Campbell J Barton
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+
+# <pep8 compliant>
+
+# History
+#
+# Originally written by Matt Ebb
+
+import bpy
+import os
+
+
+def guess_player_path(preset):
+ import sys
+
+ if preset == 'BLENDER24':
+ player_path = "blender"
+
+ if sys.platform == "darwin":
+ test_path = "/Applications/blender 2.49.app/Contents/MacOS/blender"
+ elif sys.platform[:3] == "win":
+ test_path = "/Program Files/Blender Foundation/Blender/blender.exe"
+
+ if os.path.exists(test_path):
+ player_path = test_path
+
+ elif preset == 'DJV':
+ player_path = "djv_view"
+
+ if sys.platform == "darwin":
+ # TODO, crummy supporting only 1 version, could find the newest installed version
+ test_path = '/Applications/djv-0.8.2.app/Contents/Resources/bin/djv_view'
+ if os.path.exists(test_path):
+ player_path = test_path
+
+ elif preset == 'FRAMECYCLER':
+ player_path = "framecycler"
+
+ elif preset == 'RV':
+ player_path = "rv"
+
+ elif preset == 'MPLAYER':
+ player_path = "mplayer"
+
+ return player_path
+
+
+class PlayRenderedAnim(bpy.types.Operator):
+ '''Plays back rendered frames/movies using an external player.'''
+ bl_idname = "render.play_rendered_anim"
+ bl_label = "Play Rendered Animation"
+ bl_options = {'REGISTER'}
+
+ def execute(self, context):
+ import subprocess
+
+ scene = context.scene
+ rd = scene.render
+ prefs = context.user_preferences
+
+ preset = prefs.filepaths.animation_player_preset
+ player_path = prefs.filepaths.animation_player
+ file_path = bpy.path.abspath(rd.filepath)
+ is_movie = rd.is_movie_format
+
+ # try and guess a command line if it doesn't exist
+ if player_path == '':
+ player_path = guess_player_path(preset)
+
+ if is_movie == False and preset in ('FRAMECYCLER', 'RV', 'MPLAYER'):
+ # replace the number with '#'
+ file_a = rd.frame_path(frame=0)
+
+ # TODO, make an api call for this
+ frame_tmp = 9
+ file_b = rd.frame_path(frame=frame_tmp)
+
+ while len(file_a) == len(file_b):
+ frame_tmp = (frame_tmp * 10) + 9
+ print(frame_tmp)
+ file_b = rd.frame_path(frame=frame_tmp)
+ file_b = rd.frame_path(frame=int(frame_tmp / 10))
+
+ file = "".join((c if file_b[i] == c else "#") for i, c in enumerate(file_a))
+ else:
+ # works for movies and images
+ file = rd.frame_path(frame=scene.frame_start)
+
+ file = bpy.path.abspath(file) # expand '//'
+
+ cmd = [player_path]
+ # extra options, fps controls etc.
+ if preset == 'BLENDER24':
+ opts = ["-a", "-f", str(rd.fps), str(rd.fps_base), file]
+ cmd.extend(opts)
+ elif preset == 'DJV':
+ opts = [file, "-playback_speed", str(rd.fps)]
+ cmd.extend(opts)
+ elif preset == 'FRAMECYCLER':
+ opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)]
+ cmd.extend(opts)
+ elif preset == 'RV':
+ opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file]
+ cmd.extend(opts)
+ elif preset == 'MPLAYER':
+ opts = []
+ if is_movie:
+ opts.append(file)
+ else:
+ opts.append("mf://%s" % file.replace("#", "?"))
+ opts += ["-mf", "fps=%.4f" % (rd.fps / rd.fps_base)]
+ opts += ["-loop", "0", "-really-quiet", "-fs"]
+ cmd.extend(opts)
+ else: # 'CUSTOM'
+ cmd.append(file)
+
+ # launch it
+ try:
+ process = subprocess.Popen(cmd)
+ except:
+ pass
+ #raise OSError("Couldn't find an external animation player.")
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
new file mode 100644
index 00000000000..16b72406c49
--- /dev/null
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -0,0 +1,134 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+from bpy.props import IntProperty
+
+
+class SequencerCrossfadeSounds(bpy.types.Operator):
+ '''Do crossfading volume animation of two selected sound strips.'''
+
+ bl_idname = "sequencer.crossfade_sounds"
+ bl_label = "Crossfade sounds"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
+ return context.scene.sequence_editor.active_strip.type == 'SOUND'
+ else:
+ return False
+
+ def execute(self, context):
+ seq1 = None
+ seq2 = None
+ for s in context.scene.sequence_editor.sequences:
+ if s.select and s.type == 'SOUND':
+ if seq1 is None:
+ seq1 = s
+ elif seq2 is None:
+ seq2 = s
+ else:
+ seq2 = None
+ break
+ if seq2 is None:
+ self.report({'ERROR'}, "Select 2 sound strips.")
+ return {'CANCELLED'}
+ if seq1.frame_final_start > seq2.frame_final_start:
+ s = seq1
+ seq1 = seq2
+ seq2 = s
+ if seq1.frame_final_end > seq2.frame_final_start:
+ tempcfra = context.scene.frame_current
+ context.scene.frame_current = seq2.frame_final_start
+ seq1.keyframe_insert('volume')
+ context.scene.frame_current = seq1.frame_final_end
+ seq1.volume = 0
+ seq1.keyframe_insert('volume')
+ seq2.keyframe_insert('volume')
+ context.scene.frame_current = seq2.frame_final_start
+ seq2.volume = 0
+ seq2.keyframe_insert('volume')
+ context.scene.frame_current = tempcfra
+ return {'FINISHED'}
+ else:
+ self.report({'ERROR'}, "The selected strips don't overlap.")
+ return {'CANCELLED'}
+
+
+class SequencerCutMulticam(bpy.types.Operator):
+ '''Cut multicam strip and select camera.'''
+
+ bl_idname = "sequencer.cut_multicam"
+ bl_label = "Cut multicam"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ camera = IntProperty(name="Camera",
+ default=1, min=1, max=32, soft_min=1, soft_max=32)
+
+ @classmethod
+ def poll(cls, context):
+ if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
+ return context.scene.sequence_editor.active_strip.type == 'MULTICAM'
+ else:
+ return False
+
+ def execute(self, context):
+ camera = self.camera
+
+ s = context.scene.sequence_editor.active_strip
+
+ if s.multicam_source == camera or camera >= s.channel:
+ return {'FINISHED'}
+
+ if not s.select:
+ s.select = True
+
+ cfra = context.scene.frame_current
+ bpy.ops.sequencer.cut(frame=cfra, type='SOFT', side='RIGHT')
+ for s in context.scene.sequence_editor.sequences_all:
+ if s.select and s.type == 'MULTICAM' and s.frame_final_start <= cfra and cfra < s.frame_final_end:
+ context.scene.sequence_editor.active_strip = s
+
+ context.scene.sequence_editor.active_strip.multicam_source = camera
+ return {'FINISHED'}
+
+
+class SequencerDeinterlaceSelectedMovies(bpy.types.Operator):
+ '''Deinterlace all selected movie sources.'''
+
+ bl_idname = "sequencer.deinterlace_selected_movies"
+ bl_label = "Deinterlace Movies"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(cls, context):
+ if context.scene and context.scene.sequence_editor:
+ return True
+ else:
+ return False
+
+ def execute(self, context):
+ for s in context.scene.sequence_editor.sequences_all:
+ if s.select and s.type == 'MOVIE':
+ s.use_deinterlace = True
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
new file mode 100644
index 00000000000..ad5ec15ff80
--- /dev/null
+++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py
@@ -0,0 +1,250 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+#for full docs see...
+# http://mediawiki.blender.org/index.php/Scripts/Manual/UV_Calculate/Follow_active_quads
+
+import bpy
+
+
+def extend(obj, operator, EXTEND_MODE):
+ me = obj.data
+ me_verts = me.vertices
+ # script will fail without UVs
+ if not me.uv_textures:
+ me.uv_textures.new()
+
+ # Toggle Edit mode
+ is_editmode = (obj.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ #t = sys.time()
+ edge_average_lengths = {}
+
+ OTHER_INDEX = 2, 3, 0, 1
+ FAST_INDICIES = 0, 2, 1, 3 # order is faster
+
+ def extend_uvs(face_source, face_target, edge_key):
+ '''
+ Takes 2 faces,
+ Projects its extends its UV coords onto the face next to it.
+ Both faces must share an edge
+ '''
+
+ def face_edge_vs(vi):
+ # assume a quad
+ return [(vi[0], vi[1]), (vi[1], vi[2]), (vi[2], vi[3]), (vi[3], vi[0])]
+
+ vidx_source = face_source.vertices
+ vidx_target = face_target.vertices
+
+ faceUVsource = me.uv_textures.active.data[face_source.index]
+ uvs_source = [faceUVsource.uv1, faceUVsource.uv2, faceUVsource.uv3, faceUVsource.uv4]
+
+ faceUVtarget = me.uv_textures.active.data[face_target.index]
+ uvs_target = [faceUVtarget.uv1, faceUVtarget.uv2, faceUVtarget.uv3, faceUVtarget.uv4]
+
+ # vertex index is the key, uv is the value
+
+ uvs_vhash_source = {vindex: uvs_source[i] for i, vindex in enumerate(vidx_source)}
+
+ uvs_vhash_target = {vindex: uvs_target[i] for i, vindex in enumerate(vidx_target)}
+
+ edge_idxs_source = face_edge_vs(vidx_source)
+ edge_idxs_target = face_edge_vs(vidx_target)
+
+ source_matching_edge = -1
+ target_matching_edge = -1
+
+ edge_key_swap = edge_key[1], edge_key[0]
+
+ try:
+ source_matching_edge = edge_idxs_source.index(edge_key)
+ except:
+ source_matching_edge = edge_idxs_source.index(edge_key_swap)
+ try:
+ target_matching_edge = edge_idxs_target.index(edge_key)
+ except:
+ target_matching_edge = edge_idxs_target.index(edge_key_swap)
+
+ edgepair_inner_source = edge_idxs_source[source_matching_edge]
+ edgepair_inner_target = edge_idxs_target[target_matching_edge]
+ edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
+ edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_matching_edge]]
+
+ if edge_idxs_source[source_matching_edge] == edge_idxs_target[target_matching_edge]:
+ iA = 0 # Flipped, most common
+ iB = 1
+ else: # The normals of these faces must be different
+ iA = 1
+ iB = 0
+
+ # Set the target UV's touching source face, no tricky calc needed,
+ uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
+ uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
+
+ # Set the 2 UV's on the target face that are not touching
+ # for this we need to do basic expaning on the source faces UV's
+ if EXTEND_MODE == 'LENGTH':
+
+ try: # divide by zero is possible
+ '''
+ measure the length of each face from the middle of each edge to the opposite
+ allong the axis we are copying, use this
+ '''
+ i1a = edgepair_outer_target[iB]
+ i2a = edgepair_inner_target[iA]
+ if i1a > i2a:
+ i1a, i2a = i2a, i1a
+
+ i1b = edgepair_outer_source[iB]
+ i2b = edgepair_inner_source[iA]
+ if i1b > i2b:
+ i1b, i2b = i2b, i1b
+ # print edge_average_lengths
+ factor = edge_average_lengths[i1a, i2a][0] / edge_average_lengths[i1b, i2b][0]
+ except:
+ # Div By Zero?
+ factor = 1.0
+
+ uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + factor * (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
+ uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + factor * (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
+
+ else:
+ # same as above but with no factors
+ uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
+ uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
+
+ if not me.uv_textures:
+ me.uv_textures.new()
+
+ face_act = me.faces.active
+ if face_act == -1:
+ operator.report({'ERROR'}, "No active face.")
+ return
+
+ face_sel = [f for f in me.faces if len(f.vertices) == 4 and f.select]
+
+ face_act_local_index = -1
+ for i, f in enumerate(face_sel):
+ if f.index == face_act:
+ face_act_local_index = i
+ break
+
+ if face_act_local_index == -1:
+ operator.report({'ERROR'}, "Active face not selected.")
+ return
+
+ # Modes
+ # 0 unsearched
+ # 1:mapped, use search from this face. - removed!!
+ # 2:all siblings have been searched. dont search again.
+ face_modes = [0] * len(face_sel)
+ face_modes[face_act_local_index] = 1 # extend UV's from this face.
+
+ # Edge connectivty
+ edge_faces = {}
+ for i, f in enumerate(face_sel):
+ for edkey in f.edge_keys:
+ try:
+ edge_faces[edkey].append(i)
+ except:
+ edge_faces[edkey] = [i]
+
+ if EXTEND_MODE == 'LENGTH':
+ edge_loops = me.edge_loops_from_faces(face_sel, [ed.key for ed in me.edges if ed.use_seam])
+ me_verts = me.vertices
+ for loop in edge_loops:
+ looplen = [0.0]
+ for ed in loop:
+ edge_average_lengths[ed] = looplen
+ looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
+ looplen[0] = looplen[0] / len(loop)
+
+ # remove seams, so we dont map accross seams.
+ for ed in me.edges:
+ if ed.use_seam:
+ # remove the edge pair if we can
+ try:
+ del edge_faces[ed.key]
+ except:
+ pass
+ # Done finding seams
+
+ # face connectivity - faces around each face
+ # only store a list of indices for each face.
+ face_faces = [[] for i in range(len(face_sel))]
+
+ for edge_key, faces in edge_faces.items():
+ if len(faces) == 2: # Only do edges with 2 face users for now
+ face_faces[faces[0]].append((faces[1], edge_key))
+ face_faces[faces[1]].append((faces[0], edge_key))
+
+ # Now we know what face is connected to what other face, map them by connectivity
+ ok = True
+ while ok:
+ ok = False
+ for i in range(len(face_sel)):
+ if face_modes[i] == 1: # searchable
+ for f_sibling, edge_key in face_faces[i]:
+ if face_modes[f_sibling] == 0:
+ face_modes[f_sibling] = 1 # mapped and search from.
+ extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
+ face_modes[i] = 1 # we can map from this one now.
+ ok = True # keep searching
+
+ face_modes[i] = 2 # dont search again
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT')
+ else:
+ me.update_tag()
+
+
+def main(context, operator):
+ obj = context.active_object
+
+ extend(obj, operator, operator.properties.mode)
+
+
+class FollowActiveQuads(bpy.types.Operator):
+ '''Follow UVs from active quads along continuous face loops'''
+ bl_idname = "uv.follow_active_quads"
+ bl_label = "Follow Active Quads"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ mode = bpy.props.EnumProperty(items=(("EVEN", "Even", "Space all UVs evently"), ("LENGTH", "Length", "Average space UVs edge length of each loop")),
+ name="Edge Length Mode",
+ description="Method to space UV edge loops",
+ default="LENGTH")
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.active_object
+ return (obj is not None and obj.type == 'MESH')
+
+ def execute(self, context):
+ main(context, self)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
new file mode 100644
index 00000000000..fedc8b15161
--- /dev/null
+++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py
@@ -0,0 +1,582 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+import mathutils
+
+from math import sqrt, pi
+
+
+class prettyface(object):
+ __slots__ = "uv", "width", "height", "children", "xoff", "yoff", "has_parent", "rot"
+
+ def __init__(self, data):
+ self.has_parent = False
+ self.rot = False # only used for triables
+ self.xoff = 0
+ self.yoff = 0
+
+ if type(data) == list: # list of data
+ self.uv = None
+
+ # join the data
+ if len(data) == 2:
+ # 2 vertical blocks
+ data[1].xoff = data[0].width
+ self.width = data[0].width * 2
+ self.height = data[0].height
+
+ elif len(data) == 4:
+ # 4 blocks all the same size
+ d = data[0].width # dimension x/y are the same
+
+ data[1].xoff += d
+ data[2].yoff += d
+
+ data[3].xoff += d
+ data[3].yoff += d
+
+ self.width = self.height = d * 2
+
+ #else:
+ # print(len(data), data)
+ # raise "Error"
+
+ for pf in data:
+ pf.has_parent = True
+
+ self.children = data
+
+ elif type(data) == tuple:
+ # 2 blender faces
+ # f, (len_min, len_mid, len_max)
+ self.uv = data
+
+ f1, lens1, lens1ord = data[0]
+ if data[1]:
+ f2, lens2, lens2ord = data[1]
+ self.width = (lens1[lens1ord[0]] + lens2[lens2ord[0]]) / 2.0
+ self.height = (lens1[lens1ord[1]] + lens2[lens2ord[1]]) / 2.0
+ else: # 1 tri :/
+ self.width = lens1[0]
+ self.height = lens1[1]
+
+ self.children = []
+
+ else: # blender face
+ # self.uv = data.uv
+ self.uv = data.id_data.uv_textures.active.data[data.index].uv # XXX25
+
+ # cos = [v.co for v in data]
+ cos = [data.id_data.vertices[v].co for v in data.vertices] # XXX25
+
+ self.width = ((cos[0] - cos[1]).length + (cos[2] - cos[3]).length) / 2.0
+ self.height = ((cos[1] - cos[2]).length + (cos[0] - cos[3]).length) / 2.0
+
+ self.children = []
+
+ def spin(self):
+ if self.uv and len(self.uv) == 4:
+ self.uv = self.uv[1], self.uv[2], self.uv[3], self.uv[0]
+
+ self.width, self.height = self.height, self.width
+ self.xoff, self.yoff = self.yoff, self.xoff # not needed?
+ self.rot = not self.rot # only for tri pairs.
+ # print("spinning")
+ for pf in self.children:
+ pf.spin()
+
+ def place(self, xoff, yoff, xfac, yfac, margin_w, margin_h):
+
+ xoff += self.xoff
+ yoff += self.yoff
+
+ for pf in self.children:
+ pf.place(xoff, yoff, xfac, yfac, margin_w, margin_h)
+
+ uv = self.uv
+ if not uv:
+ return
+
+ x1 = xoff
+ y1 = yoff
+ x2 = xoff + self.width
+ y2 = yoff + self.height
+
+ # Scale the values
+ x1 = x1 / xfac + margin_w
+ x2 = x2 / xfac - margin_w
+ y1 = y1 / yfac + margin_h
+ y2 = y2 / yfac - margin_h
+
+ # 2 Tri pairs
+ if len(uv) == 2:
+ # match the order of angle sizes of the 3d verts with the UV angles and rotate.
+ def get_tri_angles(v1, v2, v3):
+ a1 = (v2 - v1).angle(v3 - v1, pi)
+ a2 = (v1 - v2).angle(v3 - v2, pi)
+ a3 = pi - (a1 + a2) # a3= (v2 - v3).angle(v1 - v3)
+
+ return [(a1, 0), (a2, 1), (a3, 2)]
+
+ def set_uv(f, p1, p2, p3):
+
+ # cos =
+ #v1 = cos[0]-cos[1]
+ #v2 = cos[1]-cos[2]
+ #v3 = cos[2]-cos[0]
+
+ # angles_co = get_tri_angles(*[v.co for v in f])
+ angles_co = get_tri_angles(*[f.id_data.vertices[v].co for v in f.vertices]) # XXX25
+
+ angles_co.sort()
+ I = [i for a, i in angles_co]
+
+ # fuv = f.uv
+ fuv = f.id_data.uv_textures.active.data[f.index].uv # XXX25
+
+ if self.rot:
+ fuv[I[2]] = p1
+ fuv[I[1]] = p2
+ fuv[I[0]] = p3
+ else:
+ fuv[I[2]] = p1
+ fuv[I[0]] = p2
+ fuv[I[1]] = p3
+
+ f, lens, lensord = uv[0]
+
+ set_uv(f, (x1, y1), (x1, y2 - margin_h), (x2 - margin_w, y1))
+
+ if uv[1]:
+ f, lens, lensord = uv[1]
+ set_uv(f, (x2, y2), (x2, y1 + margin_h), (x1 + margin_w, y2))
+
+ else: # 1 QUAD
+ uv[1][0], uv[1][1] = x1, y1
+ uv[2][0], uv[2][1] = x1, y2
+ uv[3][0], uv[3][1] = x2, y2
+ uv[0][0], uv[0][1] = x2, y1
+
+ def __hash__(self):
+ # None unique hash
+ return self.width, self.height
+
+
+def lightmap_uvpack(meshes,
+ PREF_SEL_ONLY=True,
+ PREF_NEW_UVLAYER=False,
+ PREF_PACK_IN_ONE=False,
+ PREF_APPLY_IMAGE=False,
+ PREF_IMG_PX_SIZE=512,
+ PREF_BOX_DIV=8,
+ PREF_MARGIN_DIV=512
+ ):
+ '''
+ BOX_DIV if the maximum division of the UV map that
+ a box may be consolidated into.
+ Basicly, a lower value will be slower but waist less space
+ and a higher value will have more clumpy boxes but more waisted space
+ '''
+ import time
+
+ if not meshes:
+ return
+
+ t = time.time()
+
+ if PREF_PACK_IN_ONE:
+ if PREF_APPLY_IMAGE:
+ image = bpy.data.images.new(name="lightmap", width=PREF_IMG_PX_SIZE, height=PREF_IMG_PX_SIZE, alpha=False)
+ face_groups = [[]]
+ else:
+ face_groups = []
+
+ for me in meshes:
+ # Add face UV if it does not exist.
+ # All new faces are selected.
+ if not me.uv_textures:
+ me.uv_textures.new()
+
+ if PREF_SEL_ONLY:
+ faces = [f for f in me.faces if f.select]
+ else:
+ faces = me.faces[:]
+
+ if PREF_PACK_IN_ONE:
+ face_groups[0].extend(faces)
+ else:
+ face_groups.append(faces)
+
+ if PREF_NEW_UVLAYER:
+ me.uv_textures.new()
+
+ for face_sel in face_groups:
+ print("\nStarting unwrap")
+
+ if len(face_sel) < 4:
+ print("\tWarning, less then 4 faces, skipping")
+ continue
+
+ pretty_faces = [prettyface(f) for f in face_sel if len(f.vertices) == 4]
+
+ # Do we have any tri's
+ if len(pretty_faces) != len(face_sel):
+
+ # Now add tri's, not so simple because we need to pair them up.
+ def trylens(f):
+ # f must be a tri
+
+ # cos = [v.co for v in f]
+ cos = [f.id_data.vertices[v].co for v in f.vertices] # XXX25
+
+ lens = [(cos[0] - cos[1]).length, (cos[1] - cos[2]).length, (cos[2] - cos[0]).length]
+
+ lens_min = lens.index(min(lens))
+ lens_max = lens.index(max(lens))
+ for i in range(3):
+ if i != lens_min and i != lens_max:
+ lens_mid = i
+ break
+ lens_order = lens_min, lens_mid, lens_max
+
+ return f, lens, lens_order
+
+ tri_lengths = [trylens(f) for f in face_sel if len(f.vertices) == 3]
+ del trylens
+
+ def trilensdiff(t1, t2):
+ return\
+ abs(t1[1][t1[2][0]] - t2[1][t2[2][0]]) + \
+ abs(t1[1][t1[2][1]] - t2[1][t2[2][1]]) + \
+ abs(t1[1][t1[2][2]] - t2[1][t2[2][2]])
+
+ while tri_lengths:
+ tri1 = tri_lengths.pop()
+
+ if not tri_lengths:
+ pretty_faces.append(prettyface((tri1, None)))
+ break
+
+ best_tri_index = -1
+ best_tri_diff = 100000000.0
+
+ for i, tri2 in enumerate(tri_lengths):
+ diff = trilensdiff(tri1, tri2)
+ if diff < best_tri_diff:
+ best_tri_index = i
+ best_tri_diff = diff
+
+ pretty_faces.append(prettyface((tri1, tri_lengths.pop(best_tri_index))))
+
+ # Get the min, max and total areas
+ max_area = 0.0
+ min_area = 100000000.0
+ tot_area = 0
+ for f in face_sel:
+ area = f.area
+ if area > max_area:
+ max_area = area
+ if area < min_area:
+ min_area = area
+ tot_area += area
+
+ max_len = sqrt(max_area)
+ min_len = sqrt(min_area)
+ side_len = sqrt(tot_area)
+
+ # Build widths
+
+ curr_len = max_len
+
+ print("\tGenerating lengths...", end="")
+
+ lengths = []
+ while curr_len > min_len:
+ lengths.append(curr_len)
+ curr_len = curr_len / 2.0
+
+ # Dont allow boxes smaller then the margin
+ # since we contract on the margin, boxes that are smaller will create errors
+ # print(curr_len, side_len/MARGIN_DIV)
+ if curr_len / 4.0 < side_len / PREF_MARGIN_DIV:
+ break
+
+ if not lengths:
+ lengths.append(curr_len)
+
+ # convert into ints
+ lengths_to_ints = {}
+
+ l_int = 1
+ for l in reversed(lengths):
+ lengths_to_ints[l] = l_int
+ l_int *= 2
+
+ lengths_to_ints = list(lengths_to_ints.items())
+ lengths_to_ints.sort()
+ print("done")
+
+ # apply quantized values.
+
+ for pf in pretty_faces:
+ w = pf.width
+ h = pf.height
+ bestw_diff = 1000000000.0
+ besth_diff = 1000000000.0
+ new_w = 0.0
+ new_h = 0.0
+ for l, i in lengths_to_ints:
+ d = abs(l - w)
+ if d < bestw_diff:
+ bestw_diff = d
+ new_w = i # assign the int version
+
+ d = abs(l - h)
+ if d < besth_diff:
+ besth_diff = d
+ new_h = i # ditto
+
+ pf.width = new_w
+ pf.height = new_h
+
+ if new_w > new_h:
+ pf.spin()
+
+ print("...done")
+
+ # Since the boxes are sized in powers of 2, we can neatly group them into bigger squares
+ # this is done hierarchily, so that we may avoid running the pack function
+ # on many thousands of boxes, (under 1k is best) because it would get slow.
+ # Using an off and even dict us usefull because they are packed differently
+ # where w/h are the same, their packed in groups of 4
+ # where they are different they are packed in pairs
+ #
+ # After this is done an external pack func is done that packs the whole group.
+
+ print("\tConsolidating Boxes...", end="")
+ even_dict = {} # w/h are the same, the key is an int (w)
+ odd_dict = {} # w/h are different, the key is the (w,h)
+
+ for pf in pretty_faces:
+ w, h = pf.width, pf.height
+ if w == h:
+ even_dict.setdefault(w, []).append(pf)
+ else:
+ odd_dict.setdefault((w, h), []).append(pf)
+
+ # Count the number of boxes consolidated, only used for stats.
+ c = 0
+
+ # This is tricky. the total area of all packed boxes, then squt that to get an estimated size
+ # this is used then converted into out INT space so we can compare it with
+ # the ints assigned to the boxes size
+ # and divided by BOX_DIV, basicly if BOX_DIV is 8
+ # ...then the maximum box consolidataion (recursive grouping) will have a max width & height
+ # ...1/8th of the UV size.
+ # ...limiting this is needed or you end up with bug unused texture spaces
+ # ...however if its too high, boxpacking is way too slow for high poly meshes.
+ float_to_int_factor = lengths_to_ints[0][0]
+ if float_to_int_factor > 0:
+ max_int_dimension = int(((side_len / float_to_int_factor)) / PREF_BOX_DIV)
+ ok = True
+ else:
+ max_int_dimension = 0.0 # wont be used
+ ok = False
+
+ # RECURSIVE prettyface grouping
+ while ok:
+ ok = False
+
+ # Tall boxes in groups of 2
+ for d, boxes in odd_dict.items():
+ if d[1] < max_int_dimension:
+ #\boxes.sort(key = lambda a: len(a.children))
+ while len(boxes) >= 2:
+ # print("foo", len(boxes))
+ ok = True
+ c += 1
+ pf_parent = prettyface([boxes.pop(), boxes.pop()])
+ pretty_faces.append(pf_parent)
+
+ w, h = pf_parent.width, pf_parent.height
+
+ if w > h:
+ raise "error"
+
+ if w == h:
+ even_dict.setdefault(w, []).append(pf_parent)
+ else:
+ odd_dict.setdefault((w, h), []).append(pf_parent)
+
+ # Even boxes in groups of 4
+ for d, boxes in even_dict.items():
+ if d < max_int_dimension:
+ boxes.sort(key=lambda a: len(a.children))
+
+ while len(boxes) >= 4:
+ # print("bar", len(boxes))
+ ok = True
+ c += 1
+
+ pf_parent = prettyface([boxes.pop(), boxes.pop(), boxes.pop(), boxes.pop()])
+ pretty_faces.append(pf_parent)
+ w = pf_parent.width # width and weight are the same
+ even_dict.setdefault(w, []).append(pf_parent)
+
+ del even_dict
+ del odd_dict
+
+ orig = len(pretty_faces)
+
+ pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
+
+ # spin every second prettyface
+ # if there all vertical you get less efficiently used texture space
+ i = len(pretty_faces)
+ d = 0
+ while i:
+ i -= 1
+ pf = pretty_faces[i]
+ if pf.width != pf.height:
+ d += 1
+ if d % 2: # only pack every second
+ pf.spin()
+ # pass
+
+ print("Consolidated", c, "boxes, done")
+ # print("done", orig, len(pretty_faces))
+
+ # boxes2Pack.append([islandIdx, w,h])
+ print("\tPacking Boxes", len(pretty_faces), end="...")
+ boxes2Pack = [[0.0, 0.0, pf.width, pf.height, i] for i, pf in enumerate(pretty_faces)]
+ packWidth, packHeight = mathutils.geometry.box_pack_2d(boxes2Pack)
+
+ # print(packWidth, packHeight)
+
+ packWidth = float(packWidth)
+ packHeight = float(packHeight)
+
+ margin_w = ((packWidth) / PREF_MARGIN_DIV) / packWidth
+ margin_h = ((packHeight) / PREF_MARGIN_DIV) / packHeight
+
+ # print(margin_w, margin_h)
+ print("done")
+
+ # Apply the boxes back to the UV coords.
+ print("\twriting back UVs", end="")
+ for i, box in enumerate(boxes2Pack):
+ pretty_faces[i].place(box[0], box[1], packWidth, packHeight, margin_w, margin_h)
+ # pf.place(box[1][1], box[1][2], packWidth, packHeight, margin_w, margin_h)
+ print("done")
+
+ if PREF_APPLY_IMAGE:
+ if not PREF_PACK_IN_ONE:
+ image = Image.New("lightmap", PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24)
+
+ for f in face_sel:
+ # f.image = image
+ f.id_data.uv_textures.active.data[f.index].image = image # XXX25
+
+ for me in meshes:
+ me.update()
+
+ print("finished all %.2f " % (time.time() - t))
+
+ # Window.RedrawAll()
+
+
+def unwrap(operator, context, **kwargs):
+
+ is_editmode = (bpy.context.object.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
+ PREF_ACT_ONLY = kwargs.pop("PREF_ACT_ONLY")
+
+ meshes = []
+ if PREF_ACT_ONLY:
+ obj = context.scene.objects.active
+ if obj and obj.type == 'MESH':
+ meshes = [obj.data]
+ else:
+ meshes = {me.name: me for obj in context.selected_objects if obj.type == 'MESH' for me in (obj.data,) if not me.library if len(me.faces)}.values()
+
+ if not meshes:
+ operator.report({'ERROR'}, "No mesh object.")
+ return {'CANCELLED'}
+
+ lightmap_uvpack(meshes, **kwargs)
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+
+ return {'FINISHED'}
+
+from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty
+
+
+class LightMapPack(bpy.types.Operator):
+ '''Follow UVs from active quads along continuous face loops'''
+ bl_idname = "uv.lightmap_pack"
+ bl_label = "Lightmap Pack"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ PREF_CONTEXT = bpy.props.EnumProperty(
+ items=(("SEL_FACES", "Selected Faces", "Space all UVs evently"),
+ ("ALL_FACES", "All Faces", "Average space UVs edge length of each loop"),
+ ("ALL_OBJECTS", "Selected Mesh Object", "Average space UVs edge length of each loop")
+ ),
+ name="Selection",
+ description="")
+
+ # Image & UVs...
+ PREF_PACK_IN_ONE = BoolProperty(name="Share Tex Space", default=True, description="Objects Share texture space, map all objects into 1 uvmap")
+ PREF_NEW_UVLAYER = BoolProperty(name="New UV Layer", default=False, description="Create a new UV layer for every mesh packed")
+ PREF_APPLY_IMAGE = BoolProperty(name="New Image", default=False, description="Assign new images for every mesh (only one if shared tex space enabled)")
+ PREF_IMG_PX_SIZE = IntProperty(name="Image Size", min=64, max=5000, default=512, description="Width and Height for the new image")
+
+ # UV Packing...
+ PREF_BOX_DIV = IntProperty(name="Pack Quality", min=1, max=48, default=12, description="Pre Packing before the complex boxpack")
+ PREF_MARGIN_DIV = FloatProperty(name="Margin", min=0.001, max=1.0, default=0.1, description="Size of the margin as a division of the UV")
+
+ def execute(self, context):
+ kwargs = self.as_keywords()
+ PREF_CONTEXT = kwargs.pop("PREF_CONTEXT")
+
+ if PREF_CONTEXT == 'SEL_FACES':
+ kwargs["PREF_ACT_ONLY"] = True
+ kwargs["PREF_SEL_ONLY"] = True
+ elif PREF_CONTEXT == 'ALL_FACES':
+ kwargs["PREF_ACT_ONLY"] = True
+ kwargs["PREF_SEL_ONLY"] = False
+ elif PREF_CONTEXT == 'ALL_OBJECTS':
+ kwargs["PREF_ACT_ONLY"] = False
+ kwargs["PREF_SEL_ONLY"] = False
+ else:
+ raise Exception("invalid context")
+
+ kwargs["PREF_MARGIN_DIV"] = int(1.0 / (kwargs["PREF_MARGIN_DIV"] / 100.0))
+
+ return unwrap(self, context, **kwargs)
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
diff --git a/release/scripts/startup/bl_operators/uvcalc_smart_project.py b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
new file mode 100644
index 00000000000..4f5b1d8b233
--- /dev/null
+++ b/release/scripts/startup/bl_operators/uvcalc_smart_project.py
@@ -0,0 +1,1141 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+from mathutils import Matrix, Vector, geometry
+import bpy
+
+DEG_TO_RAD = 0.017453292519943295 # pi/180.0
+SMALL_NUM = 0.000000001
+BIG_NUM = 1e15
+
+global USER_FILL_HOLES
+global USER_FILL_HOLES_QUALITY
+USER_FILL_HOLES = None
+USER_FILL_HOLES_QUALITY = None
+
+def pointInTri2D(v, v1, v2, v3):
+ key = v1.x, v1.y, v2.x, v2.y, v3.x, v3.y
+
+ # Commented because its slower to do the bounds check, we should realy cache the bounds info for each face.
+ '''
+ # BOUNDS CHECK
+ xmin= 1000000
+ ymin= 1000000
+
+ xmax= -1000000
+ ymax= -1000000
+
+ for i in (0,2,4):
+ x= key[i]
+ y= key[i+1]
+
+ if xmax<x: xmax= x
+ if ymax<y: ymax= y
+ if xmin>x: xmin= x
+ if ymin>y: ymin= y
+
+ x= v.x
+ y= v.y
+
+ if x<xmin or x>xmax or y < ymin or y > ymax:
+ return False
+ # Done with bounds check
+ '''
+ try:
+ mtx = dict_matrix[key]
+ if not mtx:
+ return False
+ except:
+ side1 = v2 - v1
+ side2 = v3 - v1
+
+ nor = side1.cross(side2)
+
+ mtx = Matrix((side1, side2, nor))
+
+ # Zero area 2d tri, even tho we throw away zerop area faces
+ # the projection UV can result in a zero area UV.
+ if not mtx.determinant():
+ dict_matrix[key] = None
+ return False
+
+ mtx.invert()
+
+ dict_matrix[key] = mtx
+
+ uvw = (v - v1) * mtx
+ return 0 <= uvw[0] and 0 <= uvw[1] and uvw[0] + uvw[1] <= 1
+
+
+def boundsIsland(faces):
+ minx = maxx = faces[0].uv[0][0] # Set initial bounds.
+ miny = maxy = faces[0].uv[0][1]
+ # print len(faces), minx, maxx, miny , maxy
+ for f in faces:
+ for uv in f.uv:
+ x= uv.x
+ y= uv.y
+ if x<minx: minx= x
+ if y<miny: miny= y
+ if x>maxx: maxx= x
+ if y>maxy: maxy= y
+
+ return minx, miny, maxx, maxy
+
+"""
+def boundsEdgeLoop(edges):
+ minx = maxx = edges[0][0] # Set initial bounds.
+ miny = maxy = edges[0][1]
+ # print len(faces), minx, maxx, miny , maxy
+ for ed in edges:
+ for pt in ed:
+ print 'ass'
+ x= pt[0]
+ y= pt[1]
+ if x<minx: x= minx
+ if y<miny: y= miny
+ if x>maxx: x= maxx
+ if y>maxy: y= maxy
+
+ return minx, miny, maxx, maxy
+"""
+
+# Turns the islands into a list of unpordered edges (Non internal)
+# Onlt for UV's
+# only returns outline edges for intersection tests. and unique points.
+
+def island2Edge(island):
+
+ # Vert index edges
+ edges = {}
+
+ unique_points= {}
+
+ for f in island:
+ f_uvkey= map(tuple, f.uv)
+
+
+ for vIdx, edkey in enumerate(f.edge_keys):
+ unique_points[f_uvkey[vIdx]] = f.uv[vIdx]
+
+ if f.v[vIdx].index > f.v[vIdx-1].index:
+ i1= vIdx-1; i2= vIdx
+ else:
+ i1= vIdx; i2= vIdx-1
+
+ try: edges[ f_uvkey[i1], f_uvkey[i2] ] *= 0 # sets eny edge with more then 1 user to 0 are not returned.
+ except: edges[ f_uvkey[i1], f_uvkey[i2] ] = (f.uv[i1] - f.uv[i2]).length,
+
+ # If 2 are the same then they will be together, but full [a,b] order is not correct.
+
+ # Sort by length
+
+
+ length_sorted_edges = [(Vector(key[0]), Vector(key[1]), value) for key, value in edges.items() if value != 0]
+
+ try: length_sorted_edges.sort(key = lambda A: -A[2]) # largest first
+ except: length_sorted_edges.sort(lambda A, B: cmp(B[2], A[2]))
+
+ # Its okay to leave the length in there.
+ #for e in length_sorted_edges:
+ # e.pop(2)
+
+ # return edges and unique points
+ return length_sorted_edges, [v.to_3d() for v in unique_points.values()]
+
+# ========================= NOT WORKING????
+# Find if a points inside an edge loop, un-orderd.
+# pt is and x/y
+# edges are a non ordered loop of edges.
+# #offsets are the edge x and y offset.
+"""
+def pointInEdges(pt, edges):
+ #
+ x1 = pt[0]
+ y1 = pt[1]
+
+ # Point to the left of this line.
+ x2 = -100000
+ y2 = -10000
+ intersectCount = 0
+ for ed in edges:
+ xi, yi = lineIntersection2D(x1,y1, x2,y2, ed[0][0], ed[0][1], ed[1][0], ed[1][1])
+ if xi != None: # Is there an intersection.
+ intersectCount+=1
+
+ return intersectCount % 2
+"""
+
+def pointInIsland(pt, island):
+ vec1, vec2, vec3 = Vector(), Vector(), Vector()
+ for f in island:
+ vec1.x, vec1.y = f.uv[0]
+ vec2.x, vec2.y = f.uv[1]
+ vec3.x, vec3.y = f.uv[2]
+
+ if pointInTri2D(pt, vec1, vec2, vec3):
+ return True
+
+ if len(f.v) == 4:
+ vec1.x, vec1.y = f.uv[0]
+ vec2.x, vec2.y = f.uv[2]
+ vec3.x, vec3.y = f.uv[3]
+ if pointInTri2D(pt, vec1, vec2, vec3):
+ return True
+ return False
+
+
+# box is (left,bottom, right, top)
+def islandIntersectUvIsland(source, target, SourceOffset):
+ # Is 1 point in the box, inside the vertLoops
+ edgeLoopsSource = source[6] # Pretend this is offset
+ edgeLoopsTarget = target[6]
+
+ # Edge intersect test
+ for ed in edgeLoopsSource:
+ for seg in edgeLoopsTarget:
+ i = geometry.intersect_line_line_2d(\
+ seg[0], seg[1], SourceOffset+ed[0], SourceOffset+ed[1])
+ if i:
+ return 1 # LINE INTERSECTION
+
+ # 1 test for source being totally inside target
+ SourceOffset.resize_3d()
+ for pv in source[7]:
+ if pointInIsland(pv+SourceOffset, target[0]):
+ return 2 # SOURCE INSIDE TARGET
+
+ # 2 test for a part of the target being totaly inside the source.
+ for pv in target[7]:
+ if pointInIsland(pv-SourceOffset, source[0]):
+ return 3 # PART OF TARGET INSIDE SOURCE.
+
+ return 0 # NO INTERSECTION
+
+
+
+
+# Returns the X/y Bounds of a list of vectors.
+def testNewVecLs2DRotIsBetter(vecs, mat=-1, bestAreaSoFar = -1):
+
+ # UV's will never extend this far.
+ minx = miny = BIG_NUM
+ maxx = maxy = -BIG_NUM
+
+ for i, v in enumerate(vecs):
+
+ # Do this allong the way
+ if mat != -1:
+ v = vecs[i] = v*mat
+ x= v.x
+ y= v.y
+ if x<minx: minx= x
+ if y<miny: miny= y
+ if x>maxx: maxx= x
+ if y>maxy: maxy= y
+
+ # Spesific to this algo, bail out if we get bigger then the current area
+ if bestAreaSoFar != -1 and (maxx-minx) * (maxy-miny) > bestAreaSoFar:
+ return (BIG_NUM, None), None
+ w = maxx-minx
+ h = maxy-miny
+ return (w*h, w,h), vecs # Area, vecs
+
+def optiRotateUvIsland(faces):
+ global currentArea
+
+ # Bestfit Rotation
+ def best2dRotation(uvVecs, MAT1, MAT2):
+ global currentArea
+
+ newAreaPos, newfaceProjectionGroupListPos =\
+ testNewVecLs2DRotIsBetter(uvVecs[:], MAT1, currentArea[0])
+
+
+ # Why do I use newpos here? May as well give the best area to date for an early bailout
+ # some slight speed increase in this.
+ # If the new rotation is smaller then the existing, we can
+ # avoid copying a list and overwrite the old, crappy one.
+
+ if newAreaPos[0] < currentArea[0]:
+ newAreaNeg, newfaceProjectionGroupListNeg =\
+ testNewVecLs2DRotIsBetter(uvVecs, MAT2, newAreaPos[0]) # Reuse the old bigger list.
+ else:
+ newAreaNeg, newfaceProjectionGroupListNeg =\
+ testNewVecLs2DRotIsBetter(uvVecs[:], MAT2, currentArea[0]) # Cant reuse, make a copy.
+
+
+ # Now from the 3 options we need to discover which to use
+ # we have cerrentArea/newAreaPos/newAreaNeg
+ bestArea = min(currentArea[0], newAreaPos[0], newAreaNeg[0])
+
+ if currentArea[0] == bestArea:
+ return uvVecs
+ elif newAreaPos[0] == bestArea:
+ uvVecs = newfaceProjectionGroupListPos
+ currentArea = newAreaPos
+ elif newAreaNeg[0] == bestArea:
+ uvVecs = newfaceProjectionGroupListNeg
+ currentArea = newAreaNeg
+
+ return uvVecs
+
+
+ # Serialized UV coords to Vectors
+ uvVecs = [uv for f in faces for uv in f.uv]
+
+ # Theres a small enough number of these to hard code it
+ # rather then a loop.
+
+ # Will not modify anything
+ currentArea, dummy =\
+ testNewVecLs2DRotIsBetter(uvVecs)
+
+
+ # Try a 45d rotation
+ newAreaPos, newfaceProjectionGroupListPos = testNewVecLs2DRotIsBetter(uvVecs[:], ROTMAT_2D_POS_45D, currentArea[0])
+
+ if newAreaPos[0] < currentArea[0]:
+ uvVecs = newfaceProjectionGroupListPos
+ currentArea = newAreaPos
+ # 45d done
+
+ # Testcase different rotations and find the onfe that best fits in a square
+ for ROTMAT in RotMatStepRotation:
+ uvVecs = best2dRotation(uvVecs, ROTMAT[0], ROTMAT[1])
+
+ # Only if you want it, make faces verticle!
+ if currentArea[1] > currentArea[2]:
+ # Rotate 90d
+ # Work directly on the list, no need to return a value.
+ testNewVecLs2DRotIsBetter(uvVecs, ROTMAT_2D_POS_90D)
+
+
+ # Now write the vectors back to the face UV's
+ i = 0 # count the serialized uv/vectors
+ for f in faces:
+ #f.uv = [uv for uv in uvVecs[i:len(f)+i] ]
+ for j, k in enumerate(range(i, len(f.v)+i)):
+ f.uv[j][:] = uvVecs[k]
+ i += len(f.v)
+
+
+# Takes an island list and tries to find concave, hollow areas to pack smaller islands into.
+def mergeUvIslands(islandList):
+ global USER_FILL_HOLES
+ global USER_FILL_HOLES_QUALITY
+
+
+ # Pack islands to bottom LHS
+ # Sync with island
+
+ #islandTotFaceArea = [] # A list of floats, each island area
+ #islandArea = [] # a list of tuples ( area, w,h)
+
+
+ decoratedIslandList = []
+
+ islandIdx = len(islandList)
+ while islandIdx:
+ islandIdx-=1
+ minx, miny, maxx, maxy = boundsIsland(islandList[islandIdx])
+ w, h = maxx-minx, maxy-miny
+
+ totFaceArea = 0
+ offset= Vector((minx, miny))
+ for f in islandList[islandIdx]:
+ for uv in f.uv:
+ uv -= offset
+
+ totFaceArea += f.area
+
+ islandBoundsArea = w*h
+ efficiency = abs(islandBoundsArea - totFaceArea)
+
+ # UV Edge list used for intersections as well as unique points.
+ edges, uniqueEdgePoints = island2Edge(islandList[islandIdx])
+
+ decoratedIslandList.append([islandList[islandIdx], totFaceArea, efficiency, islandBoundsArea, w,h, edges, uniqueEdgePoints])
+
+
+ # Sort by island bounding box area, smallest face area first.
+ # no.. chance that to most simple edge loop first.
+ decoratedIslandListAreaSort =decoratedIslandList[:]
+
+ decoratedIslandListAreaSort.sort(key = lambda A: A[3])
+
+ # sort by efficiency, Least Efficient first.
+ decoratedIslandListEfficSort = decoratedIslandList[:]
+ # decoratedIslandListEfficSort.sort(lambda A, B: cmp(B[2], A[2]))
+
+ decoratedIslandListEfficSort.sort(key = lambda A: -A[2])
+
+ # ================================================== THESE CAN BE TWEAKED.
+ # This is a quality value for the number of tests.
+ # from 1 to 4, generic quality value is from 1 to 100
+ USER_STEP_QUALITY = ((USER_FILL_HOLES_QUALITY - 1) / 25.0) + 1
+
+ # If 100 will test as long as there is enough free space.
+ # this is rarely enough, and testing takes a while, so lower quality speeds this up.
+
+ # 1 means they have the same quality
+ USER_FREE_SPACE_TO_TEST_QUALITY = 1 + (((100 - USER_FILL_HOLES_QUALITY)/100.0) *5)
+
+ #print 'USER_STEP_QUALITY', USER_STEP_QUALITY
+ #print 'USER_FREE_SPACE_TO_TEST_QUALITY', USER_FREE_SPACE_TO_TEST_QUALITY
+
+ removedCount = 0
+
+ areaIslandIdx = 0
+ ctrl = Window.Qual.CTRL
+ BREAK= False
+ while areaIslandIdx < len(decoratedIslandListAreaSort) and not BREAK:
+ sourceIsland = decoratedIslandListAreaSort[areaIslandIdx]
+ # Alredy packed?
+ if not sourceIsland[0]:
+ areaIslandIdx+=1
+ else:
+ efficIslandIdx = 0
+ while efficIslandIdx < len(decoratedIslandListEfficSort) and not BREAK:
+
+ if Window.GetKeyQualifiers() & ctrl:
+ BREAK= True
+ break
+
+ # Now we have 2 islands, is the efficience of the islands lowers theres an
+ # increasing likely hood that we can fit merge into the bigger UV island.
+ # this ensures a tight fit.
+
+ # Just use figures we have about user/unused area to see if they might fit.
+
+ targetIsland = decoratedIslandListEfficSort[efficIslandIdx]
+
+
+ if sourceIsland[0] == targetIsland[0] or\
+ not targetIsland[0] or\
+ not sourceIsland[0]:
+ pass
+ else:
+
+ # ([island, totFaceArea, efficiency, islandArea, w,h])
+ # Waisted space on target is greater then UV bounding island area.
+
+
+ # if targetIsland[3] > (sourceIsland[2]) and\ #
+ # print USER_FREE_SPACE_TO_TEST_QUALITY
+ if targetIsland[2] > (sourceIsland[1] * USER_FREE_SPACE_TO_TEST_QUALITY) and\
+ targetIsland[4] > sourceIsland[4] and\
+ targetIsland[5] > sourceIsland[5]:
+
+ # DEBUG # print '%.10f %.10f' % (targetIsland[3], sourceIsland[1])
+
+ # These enough spare space lets move the box until it fits
+
+ # How many times does the source fit into the target x/y
+ blockTestXUnit = targetIsland[4]/sourceIsland[4]
+ blockTestYUnit = targetIsland[5]/sourceIsland[5]
+
+ boxLeft = 0
+
+
+ # Distllllance we can move between whilst staying inside the targets bounds.
+ testWidth = targetIsland[4] - sourceIsland[4]
+ testHeight = targetIsland[5] - sourceIsland[5]
+
+ # Increment we move each test. x/y
+ xIncrement = (testWidth / (blockTestXUnit * ((USER_STEP_QUALITY/50)+0.1)))
+ yIncrement = (testHeight / (blockTestYUnit * ((USER_STEP_QUALITY/50)+0.1)))
+
+ # Make sure were not moving less then a 3rg of our width/height
+ if xIncrement<sourceIsland[4]/3:
+ xIncrement= sourceIsland[4]
+ if yIncrement<sourceIsland[5]/3:
+ yIncrement= sourceIsland[5]
+
+
+ boxLeft = 0 # Start 1 back so we can jump into the loop.
+ boxBottom= 0 #-yIncrement
+
+ ##testcount= 0
+
+ while boxBottom <= testHeight:
+ # Should we use this? - not needed for now.
+ #if Window.GetKeyQualifiers() & ctrl:
+ # BREAK= True
+ # break
+
+ ##testcount+=1
+ #print 'Testing intersect'
+ Intersect = islandIntersectUvIsland(sourceIsland, targetIsland, Vector((boxLeft, boxBottom)))
+ #print 'Done', Intersect
+ if Intersect == 1: # Line intersect, dont bother with this any more
+ pass
+
+ if Intersect == 2: # Source inside target
+ '''
+ We have an intersection, if we are inside the target
+ then move us 1 whole width accross,
+ Its possible this is a bad idea since 2 skinny Angular faces
+ could join without 1 whole move, but its a lot more optimal to speed this up
+ since we have already tested for it.
+
+ It gives about 10% speedup with minimal errors.
+ '''
+ #print 'ass'
+ # Move the test allong its width + SMALL_NUM
+ #boxLeft += sourceIsland[4] + SMALL_NUM
+ boxLeft += sourceIsland[4]
+ elif Intersect == 0: # No intersection?? Place it.
+ # Progress
+ removedCount +=1
+#XXX Window.DrawProgressBar(0.0, 'Merged: %i islands, Ctrl to finish early.' % removedCount)
+
+ # Move faces into new island and offset
+ targetIsland[0].extend(sourceIsland[0])
+ offset= Vector((boxLeft, boxBottom))
+
+ for f in sourceIsland[0]:
+ for uv in f.uv:
+ uv+= offset
+
+ sourceIsland[0][:] = [] # Empty
+
+
+ # Move edge loop into new and offset.
+ # targetIsland[6].extend(sourceIsland[6])
+ #while sourceIsland[6]:
+ targetIsland[6].extend( [ (\
+ (e[0]+offset, e[1]+offset, e[2])\
+ ) for e in sourceIsland[6] ] )
+
+ sourceIsland[6][:] = [] # Empty
+
+ # Sort by edge length, reverse so biggest are first.
+
+ try: targetIsland[6].sort(key = lambda A: A[2])
+ except: targetIsland[6].sort(lambda B,A: cmp(A[2], B[2] ))
+
+
+ targetIsland[7].extend(sourceIsland[7])
+ offset= Vector((boxLeft, boxBottom, 0.0))
+ for p in sourceIsland[7]:
+ p+= offset
+
+ sourceIsland[7][:] = []
+
+
+ # Decrement the efficiency
+ targetIsland[1]+=sourceIsland[1] # Increment totFaceArea
+ targetIsland[2]-=sourceIsland[1] # Decrement efficiency
+ # IF we ever used these again, should set to 0, eg
+ sourceIsland[2] = 0 # No area if anyone wants to know
+
+ break
+
+
+ # INCREMENR NEXT LOCATION
+ if boxLeft > testWidth:
+ boxBottom += yIncrement
+ boxLeft = 0.0
+ else:
+ boxLeft += xIncrement
+ ##print testcount
+
+ efficIslandIdx+=1
+ areaIslandIdx+=1
+
+ # Remove empty islands
+ i = len(islandList)
+ while i:
+ i-=1
+ if not islandList[i]:
+ del islandList[i] # Can increment islands removed here.
+
+# Takes groups of faces. assumes face groups are UV groups.
+def getUvIslands(faceGroups, me):
+
+ # Get seams so we dont cross over seams
+ edge_seams = {} # shoudl be a set
+ for ed in me.edges:
+ if ed.use_seam:
+ edge_seams[ed.key] = None # dummy var- use sets!
+ # Done finding seams
+
+
+ islandList = []
+
+#XXX Window.DrawProgressBar(0.0, 'Splitting %d projection groups into UV islands:' % len(faceGroups))
+ #print '\tSplitting %d projection groups into UV islands:' % len(faceGroups),
+ # Find grouped faces
+
+ faceGroupIdx = len(faceGroups)
+
+ while faceGroupIdx:
+ faceGroupIdx-=1
+ faces = faceGroups[faceGroupIdx]
+
+ if not faces:
+ continue
+
+ # Build edge dict
+ edge_users = {}
+
+ for i, f in enumerate(faces):
+ for ed_key in f.edge_keys:
+ if ed_key in edge_seams: # DELIMIT SEAMS! ;)
+ edge_users[ed_key] = [] # so as not to raise an error
+ else:
+ try: edge_users[ed_key].append(i)
+ except: edge_users[ed_key] = [i]
+
+ # Modes
+ # 0 - face not yet touched.
+ # 1 - added to island list, and need to search
+ # 2 - touched and searched - dont touch again.
+ face_modes = [0] * len(faces) # initialize zero - untested.
+
+ face_modes[0] = 1 # start the search with face 1
+
+ newIsland = []
+
+ newIsland.append(faces[0])
+
+
+ ok = True
+ while ok:
+
+ ok = True
+ while ok:
+ ok= False
+ for i in range(len(faces)):
+ if face_modes[i] == 1: # search
+ for ed_key in faces[i].edge_keys:
+ for ii in edge_users[ed_key]:
+ if i != ii and face_modes[ii] == 0:
+ face_modes[ii] = ok = 1 # mark as searched
+ newIsland.append(faces[ii])
+
+ # mark as searched, dont look again.
+ face_modes[i] = 2
+
+ islandList.append(newIsland)
+
+ ok = False
+ for i in range(len(faces)):
+ if face_modes[i] == 0:
+ newIsland = []
+ newIsland.append(faces[i])
+
+ face_modes[i] = ok = 1
+ break
+ # if not ok will stop looping
+
+#XXX Window.DrawProgressBar(0.1, 'Optimizing Rotation for %i UV Islands' % len(islandList))
+
+ for island in islandList:
+ optiRotateUvIsland(island)
+
+ return islandList
+
+
+def packIslands(islandList):
+ if USER_FILL_HOLES:
+#XXX Window.DrawProgressBar(0.1, 'Merging Islands (Ctrl: skip merge)...')
+ mergeUvIslands(islandList) # Modify in place
+
+
+ # Now we have UV islands, we need to pack them.
+
+ # Make a synchronised list with the islands
+ # so we can box pak the islands.
+ packBoxes = []
+
+ # Keep a list of X/Y offset so we can save time by writing the
+ # uv's and packed data in one pass.
+ islandOffsetList = []
+
+ islandIdx = 0
+
+ while islandIdx < len(islandList):
+ minx, miny, maxx, maxy = boundsIsland(islandList[islandIdx])
+
+ w, h = maxx-minx, maxy-miny
+
+ if USER_ISLAND_MARGIN:
+ minx -= USER_ISLAND_MARGIN# *w
+ miny -= USER_ISLAND_MARGIN# *h
+ maxx += USER_ISLAND_MARGIN# *w
+ maxy += USER_ISLAND_MARGIN# *h
+
+ # recalc width and height
+ w, h = maxx-minx, maxy-miny
+
+ if w < 0.00001 or h < 0.00001:
+ del islandList[islandIdx]
+ islandIdx -=1
+ continue
+
+ '''Save the offset to be applied later,
+ we could apply to the UVs now and allign them to the bottom left hand area
+ of the UV coords like the box packer imagines they are
+ but, its quicker just to remember their offset and
+ apply the packing and offset in 1 pass '''
+ islandOffsetList.append((minx, miny))
+
+ # Add to boxList. use the island idx for the BOX id.
+ packBoxes.append([0, 0, w, h])
+ islandIdx+=1
+
+ # Now we have a list of boxes to pack that syncs
+ # with the islands.
+
+ #print '\tPacking UV Islands...'
+#XXX Window.DrawProgressBar(0.7, 'Packing %i UV Islands...' % len(packBoxes) )
+
+ # time1 = time.time()
+ packWidth, packHeight = geometry.box_pack_2d(packBoxes)
+
+ # print 'Box Packing Time:', time.time() - time1
+
+ #if len(pa ckedLs) != len(islandList):
+ # raise "Error packed boxes differes from original length"
+
+ #print '\tWriting Packed Data to faces'
+#XXX Window.DrawProgressBar(0.8, 'Writing Packed Data to faces')
+
+ # Sort by ID, so there in sync again
+ islandIdx = len(islandList)
+ # Having these here avoids devide by 0
+ if islandIdx:
+
+ if USER_STRETCH_ASPECT:
+ # Maximize to uv area?? Will write a normalize function.
+ xfactor = 1.0 / packWidth
+ yfactor = 1.0 / packHeight
+ else:
+ # Keep proportions.
+ xfactor = yfactor = 1.0 / max(packWidth, packHeight)
+
+ while islandIdx:
+ islandIdx -=1
+ # Write the packed values to the UV's
+
+ xoffset = packBoxes[islandIdx][0] - islandOffsetList[islandIdx][0]
+ yoffset = packBoxes[islandIdx][1] - islandOffsetList[islandIdx][1]
+
+ for f in islandList[islandIdx]: # Offsetting the UV's so they fit in there packed box
+ for uv in f.uv:
+ uv.x= (uv.x+xoffset) * xfactor
+ uv.y= (uv.y+yoffset) * yfactor
+
+
+
+def VectoQuat(vec):
+ vec = vec.normalized()
+ if abs(vec.x) > 0.5:
+ return vec.to_track_quat('Z', 'X')
+ else:
+ return vec.to_track_quat('Z', 'Y')
+
+
+class thickface(object):
+ __slost__= 'v', 'uv', 'no', 'area', 'edge_keys'
+ def __init__(self, face, uvface, mesh_verts):
+ self.v = [mesh_verts[i] for i in face.vertices]
+ if len(self.v)==4:
+ self.uv = uvface.uv1, uvface.uv2, uvface.uv3, uvface.uv4
+ else:
+ self.uv = uvface.uv1, uvface.uv2, uvface.uv3
+
+ self.no = face.normal
+ self.area = face.area
+ self.edge_keys = face.edge_keys
+
+
+def main_consts():
+ from math import radians
+
+ global ROTMAT_2D_POS_90D
+ global ROTMAT_2D_POS_45D
+ global RotMatStepRotation
+
+ ROTMAT_2D_POS_90D = Matrix.Rotation( radians(90.0), 2)
+ ROTMAT_2D_POS_45D = Matrix.Rotation( radians(45.0), 2)
+
+ RotMatStepRotation = []
+ rot_angle = 22.5 #45.0/2
+ while rot_angle > 0.1:
+ RotMatStepRotation.append([\
+ Matrix.Rotation( radians(rot_angle), 2),\
+ Matrix.Rotation( radians(-rot_angle), 2)])
+
+ rot_angle = rot_angle/2.0
+
+
+global ob
+ob = None
+def main(context, island_margin, projection_limit):
+ global USER_FILL_HOLES
+ global USER_FILL_HOLES_QUALITY
+ global USER_STRETCH_ASPECT
+ global USER_ISLAND_MARGIN
+
+ from math import cos
+ import time
+
+ global dict_matrix
+ dict_matrix = {}
+
+
+ # Constants:
+ # Takes a list of faces that make up a UV island and rotate
+ # until they optimally fit inside a square.
+ global ROTMAT_2D_POS_90D
+ global ROTMAT_2D_POS_45D
+ global RotMatStepRotation
+ main_consts()
+
+#XXX objects= bpy.data.scenes.active.objects
+ objects = context.selected_editable_objects
+
+
+ # we can will tag them later.
+ obList = [ob for ob in objects if ob.type == 'MESH']
+
+ # Face select object may not be selected.
+#XXX ob = objects.active
+ ob= objects[0]
+
+ if ob and (not ob.select) and ob.type == 'MESH':
+ # Add to the list
+ obList =[ob]
+ del objects
+
+ if not obList:
+ raise('error, no selected mesh objects')
+
+ # Create the variables.
+ USER_PROJECTION_LIMIT = projection_limit
+ USER_ONLY_SELECTED_FACES = (1)
+ USER_SHARE_SPACE = (1) # Only for hole filling.
+ USER_STRETCH_ASPECT = (1) # Only for hole filling.
+ USER_ISLAND_MARGIN = island_margin # Only for hole filling.
+ USER_FILL_HOLES = (0)
+ USER_FILL_HOLES_QUALITY = (50) # Only for hole filling.
+ USER_VIEW_INIT = (0) # Only for hole filling.
+ USER_AREA_WEIGHT = (1) # Only for hole filling.
+
+ # Reuse variable
+ if len(obList) == 1:
+ ob = "Unwrap %i Selected Mesh"
+ else:
+ ob = "Unwrap %i Selected Meshes"
+
+ # HACK, loop until mouse is lifted.
+ '''
+ while Window.GetMouseButtons() != 0:
+ time.sleep(10)
+ '''
+
+#XXX if not Draw.PupBlock(ob % len(obList), pup_block):
+#XXX return
+#XXX del ob
+
+ # Convert from being button types
+
+ USER_PROJECTION_LIMIT_CONVERTED = cos(USER_PROJECTION_LIMIT * DEG_TO_RAD)
+ USER_PROJECTION_LIMIT_HALF_CONVERTED = cos((USER_PROJECTION_LIMIT/2) * DEG_TO_RAD)
+
+
+ # Toggle Edit mode
+ is_editmode = (context.active_object.mode == 'EDIT')
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='OBJECT')
+ # Assume face select mode! an annoying hack to toggle face select mode because Mesh dosent like faceSelectMode.
+
+ if USER_SHARE_SPACE:
+ # Sort by data name so we get consistant results
+ obList.sort(key = lambda ob: ob.data.name)
+ collected_islandList= []
+
+#XXX Window.WaitCursor(1)
+
+ time1 = time.time()
+
+ # Tag as False se we dont operate on the same mesh twice.
+#XXX bpy.data.meshes.tag = False
+ for me in bpy.data.meshes:
+ me.tag = False
+
+
+ for ob in obList:
+ me = ob.data
+
+ if me.tag or me.library:
+ continue
+
+ # Tag as used
+ me.tag = True
+
+ if not me.uv_textures: # Mesh has no UV Coords, dont bother.
+ me.uv_textures.new()
+
+ uv_layer = me.uv_textures.active.data
+ me_verts = list(me.vertices)
+
+ if USER_ONLY_SELECTED_FACES:
+ meshFaces = [thickface(f, uv_layer[i], me_verts) for i, f in enumerate(me.faces) if f.select]
+ #else:
+ # meshFaces = map(thickface, me.faces)
+
+ if not meshFaces:
+ continue
+
+#XXX Window.DrawProgressBar(0.1, 'SmartProj UV Unwrapper, mapping "%s", %i faces.' % (me.name, len(meshFaces)))
+
+ # =======
+ # Generate a projection list from face normals, this is ment to be smart :)
+
+ # make a list of face props that are in sync with meshFaces
+ # Make a Face List that is sorted by area.
+ # meshFaces = []
+
+ # meshFaces.sort( lambda a, b: cmp(b.area , a.area) ) # Biggest first.
+ meshFaces.sort( key = lambda a: -a.area )
+
+ # remove all zero area faces
+ while meshFaces and meshFaces[-1].area <= SMALL_NUM:
+ # Set their UV's to 0,0
+ for uv in meshFaces[-1].uv:
+ uv.zero()
+ meshFaces.pop()
+
+ # Smallest first is slightly more efficient, but if the user cancels early then its better we work on the larger data.
+
+ # Generate Projection Vecs
+ # 0d is 1.0
+ # 180 IS -0.59846
+
+
+ # Initialize projectVecs
+ if USER_VIEW_INIT:
+ # Generate Projection
+ projectVecs = [Vector(Window.GetViewVector()) * ob.matrix_world.inverted().to_3x3()] # We add to this allong the way
+ else:
+ projectVecs = []
+
+ newProjectVec = meshFaces[0].no
+ newProjectMeshFaces = [] # Popping stuffs it up.
+
+
+ # Predent that the most unique angke is ages away to start the loop off
+ mostUniqueAngle = -1.0
+
+ # This is popped
+ tempMeshFaces = meshFaces[:]
+
+
+
+ # This while only gathers projection vecs, faces are assigned later on.
+ while 1:
+ # If theres none there then start with the largest face
+
+ # add all the faces that are close.
+ for fIdx in range(len(tempMeshFaces)-1, -1, -1):
+ # Use half the angle limit so we dont overweight faces towards this
+ # normal and hog all the faces.
+ if newProjectVec.dot(tempMeshFaces[fIdx].no) > USER_PROJECTION_LIMIT_HALF_CONVERTED:
+ newProjectMeshFaces.append(tempMeshFaces.pop(fIdx))
+
+ # Add the average of all these faces normals as a projectionVec
+ averageVec = Vector((0.0, 0.0, 0.0))
+ if USER_AREA_WEIGHT:
+ for fprop in newProjectMeshFaces:
+ averageVec += (fprop.no * fprop.area)
+ else:
+ for fprop in newProjectMeshFaces:
+ averageVec += fprop.no
+
+ if averageVec.x != 0 or averageVec.y != 0 or averageVec.z != 0: # Avoid NAN
+ projectVecs.append(averageVec.normalized())
+
+
+ # Get the next vec!
+ # Pick the face thats most different to all existing angles :)
+ mostUniqueAngle = 1.0 # 1.0 is 0d. no difference.
+ mostUniqueIndex = 0 # dummy
+
+ for fIdx in range(len(tempMeshFaces)-1, -1, -1):
+ angleDifference = -1.0 # 180d difference.
+
+ # Get the closest vec angle we are to.
+ for p in projectVecs:
+ temp_angle_diff= p.dot(tempMeshFaces[fIdx].no)
+
+ if angleDifference < temp_angle_diff:
+ angleDifference= temp_angle_diff
+
+ if angleDifference < mostUniqueAngle:
+ # We have a new most different angle
+ mostUniqueIndex = fIdx
+ mostUniqueAngle = angleDifference
+
+ if mostUniqueAngle < USER_PROJECTION_LIMIT_CONVERTED:
+ #print 'adding', mostUniqueAngle, USER_PROJECTION_LIMIT, len(newProjectMeshFaces)
+ # Now weight the vector to all its faces, will give a more direct projection
+ # if the face its self was not representive of the normal from surrounding faces.
+
+ newProjectVec = tempMeshFaces[mostUniqueIndex].no
+ newProjectMeshFaces = [tempMeshFaces.pop(mostUniqueIndex)]
+
+
+ else:
+ if len(projectVecs) >= 1: # Must have at least 2 projections
+ break
+
+
+ # If there are only zero area faces then its possible
+ # there are no projectionVecs
+ if not len(projectVecs):
+ Draw.PupMenu('error, no projection vecs where generated, 0 area faces can cause this.')
+ return
+
+ faceProjectionGroupList =[[] for i in range(len(projectVecs)) ]
+
+ # MAP and Arrange # We know there are 3 or 4 faces here
+
+ for fIdx in range(len(meshFaces)-1, -1, -1):
+ fvec = meshFaces[fIdx].no
+ i = len(projectVecs)
+
+ # Initialize first
+ bestAng = fvec.dot(projectVecs[0])
+ bestAngIdx = 0
+
+ # Cycle through the remaining, first already done
+ while i-1:
+ i-=1
+
+ newAng = fvec.dot(projectVecs[i])
+ if newAng > bestAng: # Reverse logic for dotvecs
+ bestAng = newAng
+ bestAngIdx = i
+
+ # Store the area for later use.
+ faceProjectionGroupList[bestAngIdx].append(meshFaces[fIdx])
+
+ # Cull faceProjectionGroupList,
+
+
+ # Now faceProjectionGroupList is full of faces that face match the project Vecs list
+ for i in range(len(projectVecs)):
+ # Account for projectVecs having no faces.
+ if not faceProjectionGroupList[i]:
+ continue
+
+ # Make a projection matrix from a unit length vector.
+ MatQuat = VectoQuat(projectVecs[i])
+
+ # Get the faces UV's from the projected vertex.
+ for f in faceProjectionGroupList[i]:
+ f_uv = f.uv
+ for j, v in enumerate(f.v):
+ # XXX - note, between mathutils in 2.4 and 2.5 the order changed.
+ f_uv[j][:] = (v.co * MatQuat)[:2]
+
+
+ if USER_SHARE_SPACE:
+ # Should we collect and pack later?
+ islandList = getUvIslands(faceProjectionGroupList, me)
+ collected_islandList.extend(islandList)
+
+ else:
+ # Should we pack the islands for this 1 object?
+ islandList = getUvIslands(faceProjectionGroupList, me)
+ packIslands(islandList)
+
+
+ # update the mesh here if we need to.
+
+ # We want to pack all in 1 go, so pack now
+ if USER_SHARE_SPACE:
+#XXX Window.DrawProgressBar(0.9, "Box Packing for all objects...")
+ packIslands(collected_islandList)
+
+ print("Smart Projection time: %.2f" % (time.time() - time1))
+ # Window.DrawProgressBar(0.9, "Smart Projections done, time: %.2f sec." % (time.time() - time1))
+
+ if is_editmode:
+ bpy.ops.object.mode_set(mode='EDIT')
+
+ dict_matrix.clear()
+
+#XXX Window.DrawProgressBar(1.0, "")
+#XXX Window.WaitCursor(0)
+#XXX Window.RedrawAll()
+
+"""
+ pup_block = [\
+ 'Projection',\
+* ('Angle Limit:', USER_PROJECTION_LIMIT, 1, 89, ''),\
+ ('Selected Faces Only', USER_ONLY_SELECTED_FACES, 'Use only selected faces from all selected meshes.'),\
+ ('Init from view', USER_VIEW_INIT, 'The first projection will be from the view vector.'),\
+ ('Area Weight', USER_AREA_WEIGHT, 'Weight projections vector by face area.'),\
+ '',\
+ '',\
+ '',\
+ 'UV Layout',\
+ ('Share Tex Space', USER_SHARE_SPACE, 'Objects Share texture space, map all objects into 1 uvmap.'),\
+ ('Stretch to bounds', USER_STRETCH_ASPECT, 'Stretch the final output to texture bounds.'),\
+* ('Island Margin:', USER_ISLAND_MARGIN, 0.0, 0.5, ''),\
+ 'Fill in empty areas',\
+ ('Fill Holes', USER_FILL_HOLES, 'Fill in empty areas reduced texture waistage (slow).'),\
+ ('Fill Quality:', USER_FILL_HOLES_QUALITY, 1, 100, 'Depends on fill holes, how tightly to fill UV holes, (higher is slower)'),\
+ ]
+"""
+
+from bpy.props import FloatProperty
+
+
+class SmartProject(bpy.types.Operator):
+ '''This script projection unwraps the selected faces of a mesh. it operates on all selected mesh objects, and can be used unwrap selected faces, or all faces.'''
+ bl_idname = "uv.smart_project"
+ bl_label = "Smart UV Project"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ angle_limit = FloatProperty(name="Angle Limit",
+ description="lower for more projection groups, higher for less distortion.",
+ default=66.0, min=1.0, max=89.0)
+
+ island_margin = FloatProperty(name="Island Margin",
+ description="Margin to reduce bleed from adjacent islands.",
+ default=0.0, min=0.0, max=1.0)
+
+ @classmethod
+ def poll(cls, context):
+ return context.active_object != None
+
+ def execute(self, context):
+ main(context, self.island_margin, self.angle_limit)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
diff --git a/release/scripts/startup/bl_operators/vertexpaint_dirt.py b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
new file mode 100644
index 00000000000..ca8a3dedd0d
--- /dev/null
+++ b/release/scripts/startup/bl_operators/vertexpaint_dirt.py
@@ -0,0 +1,176 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# Script copyright (C) Campbell J Barton
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+# --------------------------------------------------------------------------
+
+# <pep8 compliant>
+
+# History
+#
+# Originally written by Campbell Barton aka ideasman42
+#
+# 2009-11-01: * 2.5 port by Keith "Wahooney" Boshoff
+# * Replaced old method with my own, speed is similar (about 0.001 sec on Suzanne)
+# but results are far more accurate
+#
+
+
+def applyVertexDirt(me, blur_iterations, blur_strength, clamp_dirt, clamp_clean, dirt_only):
+ from mathutils import Vector
+ from math import acos
+
+ #BPyMesh.meshCalcNormals(me)
+
+ vert_tone = [0.0] * len(me.vertices)
+
+ min_tone = 180.0
+ max_tone = 0.0
+
+ # create lookup table for each vertex's connected vertices (via edges)
+ con = []
+
+ con = [[] for i in range(len(me.vertices))]
+
+ # add connected verts
+ for e in me.edges:
+ con[e.vertices[0]].append(e.vertices[1])
+ con[e.vertices[1]].append(e.vertices[0])
+
+ for i, v in enumerate(me.vertices):
+ vec = Vector()
+ no = v.normal
+ co = v.co
+
+ # get the direction of the vectors between the vertex and it's connected vertices
+ for c in con[i]:
+ vec += (me.vertices[c].co - co).normalized()
+
+ # normalize the vector by dividing by the number of connected verts
+ tot_con = len(con[i])
+
+ if tot_con == 0:
+ continue
+
+ vec /= tot_con
+
+ # angle is the acos of the dot product between vert and connected verts normals
+ ang = acos(no.dot(vec))
+
+ # enforce min/max
+ ang = max(clamp_dirt, ang)
+
+ if not dirt_only:
+ ang = min(clamp_clean, ang)
+
+ vert_tone[i] = ang
+
+ # blur tones
+ for i in range(blur_iterations):
+ # backup the original tones
+ orig_vert_tone = list(vert_tone)
+
+ # use connected verts look up for blurring
+ for j, c in enumerate(con):
+ for v in c:
+ vert_tone[j] += blur_strength * orig_vert_tone[v]
+
+ vert_tone[j] /= len(c) * blur_strength + 1
+
+ min_tone = min(vert_tone)
+ max_tone = max(vert_tone)
+
+ # debug information
+ # print(min_tone * 2 * math.pi)
+ # print(max_tone * 2 * math.pi)
+ # print(clamp_clean)
+ # print(clamp_dirt)
+
+ tone_range = max_tone - min_tone
+
+ if not tone_range:
+ return
+
+ active_col_layer = None
+
+ if len(me.vertex_colors):
+ for lay in me.vertex_colors:
+ if lay.active:
+ active_col_layer = lay.data
+ else:
+ bpy.ops.mesh.vertex_color_add()
+ me.vertex_colors[0].active = True
+ active_col_layer = me.vertex_colors[0].data
+
+ if not active_col_layer:
+ return('CANCELLED', )
+
+ for i, f in enumerate(me.faces):
+ if not me.use_paint_mask or f.select:
+
+ f_col = active_col_layer[i]
+
+ f_col = [f_col.color1, f_col.color2, f_col.color3, f_col.color4]
+
+ for j, v in enumerate(f.vertices):
+ col = f_col[j]
+ tone = vert_tone[me.vertices[v].index]
+ tone = (tone - min_tone) / tone_range
+
+ if dirt_only:
+ tone = min(tone, 0.5)
+ tone *= 2
+
+ col[0] = tone * col[0]
+ col[1] = tone * col[1]
+ col[2] = tone * col[2]
+
+
+import bpy
+from bpy.props import FloatProperty, IntProperty, BoolProperty
+
+
+class VertexPaintDirt(bpy.types.Operator):
+ bl_idname = "paint.vertex_color_dirt"
+ bl_label = "Dirty Vertex Colors"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0)
+ blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40)
+ clean_angle = FloatProperty(name="Highlight Angle", description="Less then 90 limits the angle used in the tonal range", default=180.0, min=0.0, max=180.0)
+ dirt_angle = FloatProperty(name="Dirt Angle", description="Less then 90 limits the angle used in the tonal range", default=0.0, min=0.0, max=180.0)
+ dirt_only = BoolProperty(name="Dirt Only", description="Dont calculate cleans for convex areas", default=False)
+
+ def execute(self, context):
+ import time
+ from math import radians
+ obj = context.object
+
+ if not obj or obj.type != 'MESH':
+ print('Error, no active mesh object, aborting')
+ return('CANCELLED',)
+
+ mesh = obj.data
+
+ t = time.time()
+
+ applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, radians(self.dirt_angle), radians(self.clean_angle), self.dirt_only)
+
+ print('Dirt calculated in %.6f' % (time.time() - t))
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
new file mode 100644
index 00000000000..7e73fa7b647
--- /dev/null
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -0,0 +1,848 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from bpy.props import StringProperty, BoolProperty, IntProperty, FloatProperty
+from rna_prop_ui import rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear
+
+
+class MESH_OT_delete_edgeloop(bpy.types.Operator):
+ '''Delete an edge loop by merging the faces on each side to a single face loop'''
+ bl_idname = "mesh.delete_edgeloop"
+ bl_label = "Delete Edge Loop"
+
+ def execute(self, context):
+ if 'FINISHED' in bpy.ops.transform.edge_slide(value=1.0):
+ bpy.ops.mesh.select_more()
+ bpy.ops.mesh.remove_doubles()
+ return {'FINISHED'}
+
+ return {'CANCELLED'}
+
+rna_path_prop = StringProperty(name="Context Attributes",
+ description="rna context string", maxlen=1024, default="")
+
+rna_reverse_prop = BoolProperty(name="Reverse",
+ description="Cycle backwards", default=False)
+
+rna_relative_prop = BoolProperty(name="Relative",
+ description="Apply relative to the current value (delta)",
+ default=False)
+
+
+def context_path_validate(context, data_path):
+ import sys
+ try:
+ value = eval("context.%s" % data_path) if data_path else Ellipsis
+ except AttributeError:
+ if "'NoneType'" in str(sys.exc_info()[1]):
+ # One of the items in the rna path is None, just ignore this
+ value = Ellipsis
+ else:
+ # We have a real error in the rna path, dont ignore that
+ raise
+
+ return value
+
+
+def execute_context_assign(self, context):
+ if context_path_validate(context, self.data_path) is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ if getattr(self, "relative", False):
+ exec("context.%s+=self.value" % self.data_path)
+ else:
+ exec("context.%s=self.value" % self.data_path)
+
+ return {'FINISHED'}
+
+
+class BRUSH_OT_set_active_number(bpy.types.Operator):
+ '''Set active sculpt/paint brush from it's number'''
+ bl_idname = "brush.set_active_number"
+ bl_label = "Set Brush Number"
+
+ mode = StringProperty(name="mode",
+ description="Paint mode to set brush for", maxlen=1024)
+ number = IntProperty(name="number",
+ description="Brush number")
+
+ _attr_dict = {"sculpt": "use_paint_sculpt",
+ "vertex_paint": "use_paint_vertex",
+ "weight_paint": "use_paint_weight",
+ "image_paint": "use_paint_texture"}
+
+ def execute(self, context):
+ attr = self._attr_dict.get(self.mode)
+ if attr is None:
+ return {'CANCELLED'}
+
+ for i, brush in enumerate((cur for cur in bpy.data.brushes if getattr(cur, attr))):
+ if i == self.number:
+ getattr(context.tool_settings, self.mode).brush = brush
+ return {'FINISHED'}
+
+ return {'CANCELLED'}
+
+
+class WM_OT_context_set_boolean(bpy.types.Operator):
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_boolean"
+ bl_label = "Context Set Boolean"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = BoolProperty(name="Value",
+ description="Assignment value", default=True)
+
+ execute = execute_context_assign
+
+
+class WM_OT_context_set_int(bpy.types.Operator): # same as enum
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_int"
+ bl_label = "Context Set"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = IntProperty(name="Value", description="Assign value", default=0)
+ relative = rna_relative_prop
+
+ execute = execute_context_assign
+
+
+class WM_OT_context_scale_int(bpy.types.Operator):
+ '''Scale an int context value.'''
+ bl_idname = "wm.context_scale_int"
+ bl_label = "Context Set"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = FloatProperty(name="Value", description="Assign value", default=1.0)
+ always_step = BoolProperty(name="Always Step",
+ description="Always adjust the value by a minimum of 1 when 'value' is not 1.0.",
+ default=True)
+
+ def execute(self, context):
+ if context_path_validate(context, self.data_path) is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ value = self.value
+ data_path = self.data_path
+
+ if value == 1.0: # nothing to do
+ return {'CANCELLED'}
+
+ if getattr(self, "always_step", False):
+ if value > 1.0:
+ add = "1"
+ func = "max"
+ else:
+ add = "-1"
+ func = "min"
+ exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add))
+ else:
+ exec("context.%s *= value" % self.data_path)
+
+ return {'FINISHED'}
+
+
+class WM_OT_context_set_float(bpy.types.Operator): # same as enum
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_float"
+ bl_label = "Context Set Float"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = FloatProperty(name="Value",
+ description="Assignment value", default=0.0)
+ relative = rna_relative_prop
+
+ execute = execute_context_assign
+
+
+class WM_OT_context_set_string(bpy.types.Operator): # same as enum
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_string"
+ bl_label = "Context Set String"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = StringProperty(name="Value",
+ description="Assign value", maxlen=1024, default="")
+
+ execute = execute_context_assign
+
+
+class WM_OT_context_set_enum(bpy.types.Operator):
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_enum"
+ bl_label = "Context Set Enum"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = StringProperty(name="Value",
+ description="Assignment value (as a string)",
+ maxlen=1024, default="")
+
+ execute = execute_context_assign
+
+
+class WM_OT_context_set_value(bpy.types.Operator):
+ '''Set a context value.'''
+ bl_idname = "wm.context_set_value"
+ bl_label = "Context Set Value"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = StringProperty(name="Value",
+ description="Assignment value (as a string)",
+ maxlen=1024, default="")
+
+ def execute(self, context):
+ if context_path_validate(context, self.data_path) is Ellipsis:
+ return {'PASS_THROUGH'}
+ exec("context.%s=%s" % (self.data_path, self.value))
+ return {'FINISHED'}
+
+
+class WM_OT_context_toggle(bpy.types.Operator):
+ '''Toggle a context value.'''
+ bl_idname = "wm.context_toggle"
+ bl_label = "Context Toggle"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+
+ def execute(self, context):
+
+ if context_path_validate(context, self.data_path) is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ exec("context.%s=not (context.%s)" %
+ (self.data_path, self.data_path))
+
+ return {'FINISHED'}
+
+
+class WM_OT_context_toggle_enum(bpy.types.Operator):
+ '''Toggle a context value.'''
+ bl_idname = "wm.context_toggle_enum"
+ bl_label = "Context Toggle Values"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value_1 = StringProperty(name="Value", \
+ description="Toggle enum", maxlen=1024, default="")
+
+ value_2 = StringProperty(name="Value", \
+ description="Toggle enum", maxlen=1024, default="")
+
+ def execute(self, context):
+
+ if context_path_validate(context, self.data_path) is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
+ (self.data_path, self.value_1,\
+ self.value_2, self.data_path,
+ self.value_2))
+
+ return {'FINISHED'}
+
+
+class WM_OT_context_cycle_int(bpy.types.Operator):
+ '''Set a context value. Useful for cycling active material, '''
+ '''vertex keys, groups' etc.'''
+ bl_idname = "wm.context_cycle_int"
+ bl_label = "Context Int Cycle"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ reverse = rna_reverse_prop
+
+ def execute(self, context):
+ data_path = self.data_path
+ value = context_path_validate(context, data_path)
+ if value is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ if self.reverse:
+ value -= 1
+ else:
+ value += 1
+
+ exec("context.%s=value" % data_path)
+
+ if value != eval("context.%s" % data_path):
+ # relies on rna clamping int's out of the range
+ if self.reverse:
+ value = (1 << 31) - 1
+ else:
+ value = -1 << 31
+
+ exec("context.%s=value" % data_path)
+
+ return {'FINISHED'}
+
+
+class WM_OT_context_cycle_enum(bpy.types.Operator):
+ '''Toggle a context value.'''
+ bl_idname = "wm.context_cycle_enum"
+ bl_label = "Context Enum Cycle"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ reverse = rna_reverse_prop
+
+ def execute(self, context):
+
+ value = context_path_validate(context, self.data_path)
+ if value is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ orig_value = value
+
+ # Have to get rna enum values
+ rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1)
+ i = rna_prop_str.find('[')
+
+ # just incse we get "context.foo.bar[0]"
+ if i != -1:
+ rna_prop_str = rna_prop_str[0:i]
+
+ rna_struct = eval("context.%s.rna_type" % rna_struct_str)
+
+ rna_prop = rna_struct.properties[rna_prop_str]
+
+ if type(rna_prop) != bpy.types.EnumProperty:
+ raise Exception("expected an enum property")
+
+ enums = rna_struct.properties[rna_prop_str].items.keys()
+ orig_index = enums.index(orig_value)
+
+ # Have the info we need, advance to the next item
+ if self.reverse:
+ if orig_index == 0:
+ advance_enum = enums[-1]
+ else:
+ advance_enum = enums[orig_index - 1]
+ else:
+ if orig_index == len(enums) - 1:
+ advance_enum = enums[0]
+ else:
+ advance_enum = enums[orig_index + 1]
+
+ # set the new value
+ exec("context.%s=advance_enum" % self.data_path)
+ return {'FINISHED'}
+
+
+class WM_OT_context_cycle_array(bpy.types.Operator):
+ '''Set a context array value.
+ Useful for cycling the active mesh edit mode.'''
+ bl_idname = "wm.context_cycle_array"
+ bl_label = "Context Array Cycle"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ reverse = rna_reverse_prop
+
+ def execute(self, context):
+ data_path = self.data_path
+ value = context_path_validate(context, data_path)
+ if value is Ellipsis:
+ return {'PASS_THROUGH'}
+
+ def cycle(array):
+ if self.reverse:
+ array.insert(0, array.pop())
+ else:
+ array.append(array.pop(0))
+ return array
+
+ exec("context.%s=cycle(context.%s[:])" % (data_path, data_path))
+
+ return {'FINISHED'}
+
+
+class WM_MT_context_menu_enum(bpy.types.Menu):
+ bl_label = ""
+ data_path = "" # BAD DESIGN, set from operator below.
+
+ def draw(self, context):
+ data_path = self.data_path
+ value = context_path_validate(bpy.context, data_path)
+ if value is Ellipsis:
+ return {'PASS_THROUGH'}
+ base_path, prop_string = data_path.rsplit(".", 1)
+ value_base = context_path_validate(context, base_path)
+
+ values = [(i.name, i.identifier) for i in value_base.bl_rna.properties[prop_string].items]
+
+ for name, identifier in values:
+ prop = self.layout.operator("wm.context_set_enum", text=name)
+ prop.data_path = data_path
+ prop.value = identifier
+
+
+class WM_OT_context_menu_enum(bpy.types.Operator):
+ bl_idname = "wm.context_menu_enum"
+ bl_label = "Context Enum Menu"
+ bl_options = {'UNDO'}
+ data_path = rna_path_prop
+
+ def execute(self, context):
+ data_path = self.data_path
+ WM_MT_context_menu_enum.data_path = data_path
+ bpy.ops.wm.call_menu(name="WM_MT_context_menu_enum")
+ return {'PASS_THROUGH'}
+
+
+class WM_OT_context_set_id(bpy.types.Operator):
+ '''Toggle a context value.'''
+ bl_idname = "wm.context_set_id"
+ bl_label = "Set Library ID"
+ bl_options = {'UNDO'}
+
+ data_path = rna_path_prop
+ value = StringProperty(name="Value",
+ description="Assign value", maxlen=1024, default="")
+
+ def execute(self, context):
+ value = self.value
+ data_path = self.data_path
+
+ # match the pointer type from the target property to bpy.data.*
+ # so we lookup the correct list.
+ data_path_base, data_path_prop = data_path.rsplit(".", 1)
+ data_prop_rna = eval("context.%s" % data_path_base).rna_type.properties[data_path_prop]
+ data_prop_rna_type = data_prop_rna.fixed_type
+
+ id_iter = None
+
+ for prop in bpy.data.rna_type.properties:
+ if prop.rna_type.identifier == "CollectionProperty":
+ if prop.fixed_type == data_prop_rna_type:
+ id_iter = prop.identifier
+ break
+
+ if id_iter:
+ value_id = getattr(bpy.data, id_iter).get(value)
+ exec("context.%s=value_id" % data_path)
+
+ return {'FINISHED'}
+
+
+doc_id = StringProperty(name="Doc ID",
+ description="", maxlen=1024, default="", options={'HIDDEN'})
+
+doc_new = StringProperty(name="Edit Description",
+ description="", maxlen=1024, default="")
+
+
+class WM_OT_context_modal_mouse(bpy.types.Operator):
+ '''Adjust arbitrary values with mouse input'''
+ bl_idname = "wm.context_modal_mouse"
+ bl_label = "Context Modal Mouse"
+
+ data_path_iter = StringProperty(description="The data path relative to the context, must point to an iterable.")
+ data_path_item = StringProperty(description="The data path from each iterable to the value (int or float)")
+ input_scale = FloatProperty(default=0.01, description="Scale the mouse movement by this value before applying the delta")
+ invert = BoolProperty(default=False, description="Invert the mouse input")
+ initial_x = IntProperty(options={'HIDDEN'})
+
+ def _values_store(self, context):
+ data_path_iter = self.data_path_iter
+ data_path_item = self.data_path_item
+
+ self._values = values = {}
+
+ for item in getattr(context, data_path_iter):
+ try:
+ value_orig = eval("item." + data_path_item)
+ except:
+ continue
+
+ # check this can be set, maybe this is library data.
+ try:
+ exec("item.%s = %s" % (data_path_item, value_orig))
+ except:
+ continue
+
+ values[item] = value_orig
+
+ def _values_delta(self, delta):
+ delta *= self.input_scale
+ if self.invert:
+ delta = - delta
+
+ data_path_item = self.data_path_item
+ for item, value_orig in self._values.items():
+ if type(value_orig) == int:
+ exec("item.%s = int(%d)" % (data_path_item, round(value_orig + delta)))
+ else:
+ exec("item.%s = %f" % (data_path_item, value_orig + delta))
+
+ def _values_restore(self):
+ data_path_item = self.data_path_item
+ for item, value_orig in self._values.items():
+ exec("item.%s = %s" % (data_path_item, value_orig))
+
+ self._values.clear()
+
+ def _values_clear(self):
+ self._values.clear()
+
+ def modal(self, context, event):
+ event_type = event.type
+
+ if event_type == 'MOUSEMOVE':
+ delta = event.mouse_x - self.initial_x
+ self._values_delta(delta)
+
+ elif 'LEFTMOUSE' == event_type:
+ self._values_clear()
+ return {'FINISHED'}
+
+ elif event_type in ('RIGHTMOUSE', 'ESC'):
+ self._values_restore()
+ return {'FINISHED'}
+
+ return {'RUNNING_MODAL'}
+
+ def invoke(self, context, event):
+ self._values_store(context)
+
+ if not self._values:
+ self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" %
+ (self.data_path_iter, self.data_path_item))
+
+ return {'CANCELLED'}
+ else:
+ self.initial_x = event.mouse_x
+
+ context.window_manager.modal_handler_add(self)
+ return {'RUNNING_MODAL'}
+
+
+class WM_OT_url_open(bpy.types.Operator):
+ "Open a website in the Webbrowser"
+ bl_idname = "wm.url_open"
+ bl_label = ""
+
+ url = StringProperty(name="URL", description="URL to open")
+
+ def execute(self, context):
+ import webbrowser
+ webbrowser.open(self.url)
+ return {'FINISHED'}
+
+
+class WM_OT_path_open(bpy.types.Operator):
+ "Open a path in a file browser"
+ bl_idname = "wm.path_open"
+ bl_label = ""
+
+ filepath = StringProperty(name="File Path", maxlen=1024, subtype='FILE_PATH')
+
+ def execute(self, context):
+ import sys
+ import os
+ import subprocess
+
+ filepath = bpy.path.abspath(self.filepath)
+ filepath = os.path.normpath(filepath)
+
+ if not os.path.exists(filepath):
+ self.report({'ERROR'}, "File '%s' not found" % filepath)
+ return {'CANCELLED'}
+
+ if sys.platform[:3] == "win":
+ subprocess.Popen(['start', filepath], shell=True)
+ elif sys.platform == 'darwin':
+ subprocess.Popen(['open', filepath])
+ else:
+ try:
+ subprocess.Popen(['xdg-open', filepath])
+ except OSError:
+ # xdg-open *should* be supported by recent Gnome, KDE, Xfce
+ pass
+
+ return {'FINISHED'}
+
+
+class WM_OT_doc_view(bpy.types.Operator):
+ '''Load online reference docs'''
+ bl_idname = "wm.doc_view"
+ bl_label = "View Documentation"
+
+ doc_id = doc_id
+ _prefix = "http://www.blender.org/documentation/blender_python_api_%s" % "_".join(str(v) for v in bpy.app.version)
+
+ def _nested_class_string(self, class_string):
+ ls = []
+ class_obj = getattr(bpy.types, class_string, None).bl_rna
+ while class_obj:
+ ls.insert(0, class_obj)
+ class_obj = class_obj.nested
+ return '.'.join(class_obj.identifier for class_obj in ls)
+
+ def execute(self, context):
+ id_split = self.doc_id.split('.')
+ if len(id_split) == 1: # rna, class
+ url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0])
+ elif len(id_split) == 2: # rna, class.prop
+ class_name, class_prop = id_split
+
+ if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
+ url = '%s/bpy.ops.%s.html#bpy.ops.%s.%s' % \
+ (self._prefix, class_name, class_name, class_prop)
+ else:
+ # It so happens that epydoc nests these, not sphinx
+ # class_name_full = self._nested_class_string(class_name)
+ url = '%s/bpy.types.%s.html#bpy.types.%s.%s' % \
+ (self._prefix, class_name, class_name, class_prop)
+
+ else:
+ return {'PASS_THROUGH'}
+
+ import webbrowser
+ webbrowser.open(url)
+
+ return {'FINISHED'}
+
+
+class WM_OT_doc_edit(bpy.types.Operator):
+ '''Load online reference docs'''
+ bl_idname = "wm.doc_edit"
+ bl_label = "Edit Documentation"
+
+ doc_id = doc_id
+ doc_new = doc_new
+
+ _url = "http://www.mindrones.com/blender/svn/xmlrpc.php"
+
+ def _send_xmlrpc(self, data_dict):
+ print("sending data:", data_dict)
+
+ import xmlrpc.client
+ user = 'blenderuser'
+ pwd = 'blender>user'
+
+ docblog = xmlrpc.client.ServerProxy(self._url)
+ docblog.metaWeblog.newPost(1, user, pwd, data_dict, 1)
+
+ def execute(self, context):
+
+ doc_id = self.doc_id
+ doc_new = self.doc_new
+
+ class_name, class_prop = doc_id.split('.')
+
+ if not doc_new:
+ self.report({'ERROR'}, "No input given for '%s'" % doc_id)
+ return {'CANCELLED'}
+
+ # check if this is an operator
+ op_name = class_name.upper() + '_OT_' + class_prop
+ op_class = getattr(bpy.types, op_name, None)
+
+ # Upload this to the web server
+ upload = {}
+
+ if op_class:
+ rna = op_class.bl_rna
+ doc_orig = rna.description
+ if doc_orig == doc_new:
+ return {'RUNNING_MODAL'}
+
+ print("op - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
+ upload["title"] = 'OPERATOR %s:%s' % (doc_id, doc_orig)
+ else:
+ rna = getattr(bpy.types, class_name).bl_rna
+ doc_orig = rna.properties[class_prop].description
+ if doc_orig == doc_new:
+ return {'RUNNING_MODAL'}
+
+ print("rna - old:'%s' -> new:'%s'" % (doc_orig, doc_new))
+ upload["title"] = 'RNA %s:%s' % (doc_id, doc_orig)
+
+ upload["description"] = doc_new
+
+ self._send_xmlrpc(upload)
+
+ return {'FINISHED'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.label(text="Descriptor ID: '%s'" % self.doc_id)
+ layout.prop(self, "doc_new", text="")
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self, width=600)
+
+
+rna_path = StringProperty(name="Property Edit",
+ description="Property data_path edit", maxlen=1024, default="", options={'HIDDEN'})
+
+rna_value = StringProperty(name="Property Value",
+ description="Property value edit", maxlen=1024, default="")
+
+rna_property = StringProperty(name="Property Name",
+ description="Property name edit", maxlen=1024, default="")
+
+rna_min = FloatProperty(name="Min", default=0.0, precision=3)
+rna_max = FloatProperty(name="Max", default=1.0, precision=3)
+
+
+class WM_OT_properties_edit(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_edit"
+ bl_label = "Edit Property"
+ bl_options = {'REGISTER'} # only because invoke_props_popup requires.
+
+ data_path = rna_path
+ property = rna_property
+ value = rna_value
+ min = rna_min
+ max = rna_max
+ description = StringProperty(name="Tip", default="")
+
+ def execute(self, context):
+ data_path = self.data_path
+ value = self.value
+ prop = self.property
+ prop_old = self._last_prop[0]
+
+ try:
+ value_eval = eval(value)
+ except:
+ value_eval = value
+
+ # First remove
+ item = eval("context.%s" % data_path)
+
+ rna_idprop_ui_prop_clear(item, prop_old)
+ exec_str = "del item['%s']" % prop_old
+ # print(exec_str)
+ exec(exec_str)
+
+ # Reassign
+ exec_str = "item['%s'] = %s" % (prop, repr(value_eval))
+ # print(exec_str)
+ exec(exec_str)
+ self._last_prop[:] = [prop]
+
+ prop_type = type(item[prop])
+
+ prop_ui = rna_idprop_ui_prop_get(item, prop)
+
+ if prop_type in (float, int):
+
+ prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min)
+ prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max)
+
+ prop_ui['description'] = self.description
+
+ # otherwise existing buttons which reference freed
+ # memory may crash blender [#26510]
+ context.area.tag_redraw()
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+
+ self._last_prop = [self.property]
+
+ item = eval("context.%s" % self.data_path)
+
+ # setup defaults
+ prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create
+ if prop_ui:
+ self.min = prop_ui.get("min", -1000000000)
+ self.max = prop_ui.get("max", 1000000000)
+ self.description = prop_ui.get("description", "")
+
+ wm = context.window_manager
+ return wm.invoke_props_dialog(self)
+
+
+class WM_OT_properties_add(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_add"
+ bl_label = "Add Property"
+
+ data_path = rna_path
+
+ def execute(self, context):
+ item = eval("context.%s" % self.data_path)
+
+ def unique_name(names):
+ prop = 'prop'
+ prop_new = prop
+ i = 1
+ while prop_new in names:
+ prop_new = prop + str(i)
+ i += 1
+
+ return prop_new
+
+ property = unique_name(item.keys())
+
+ item[property] = 1.0
+ return {'FINISHED'}
+
+
+class WM_OT_properties_remove(bpy.types.Operator):
+ '''Internal use (edit a property data_path)'''
+ bl_idname = "wm.properties_remove"
+ bl_label = "Remove Property"
+
+ data_path = rna_path
+ property = rna_property
+
+ def execute(self, context):
+ item = eval("context.%s" % self.data_path)
+ del item[self.property]
+ return {'FINISHED'}
+
+
+class WM_OT_keyconfig_activate(bpy.types.Operator):
+ bl_idname = "wm.keyconfig_activate"
+ bl_label = "Activate Keyconfig"
+
+ filepath = StringProperty(name="File Path", maxlen=1024)
+
+ def execute(self, context):
+ bpy.utils.keyconfig_set(self.filepath)
+ return {'FINISHED'}
+
+
+class WM_OT_sysinfo(bpy.types.Operator):
+ '''Generate System Info'''
+ bl_idname = "wm.sysinfo"
+ bl_label = "System Info"
+
+ def execute(self, context):
+ import sys_info
+ sys_info.write_sysinfo(self)
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
new file mode 100644
index 00000000000..69f5d2a67ff
--- /dev/null
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -0,0 +1,120 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+# note, properties_animviz is a helper module only.
+
+if "bpy" in locals():
+ from imp import reload as _reload
+ for val in _modules_loaded.values():
+ _reload(val)
+_modules = (
+ "properties_animviz",
+ "properties_data_armature",
+ "properties_data_bone",
+ "properties_data_camera",
+ "properties_data_curve",
+ "properties_data_empty",
+ "properties_data_lamp",
+ "properties_data_lattice",
+ "properties_data_mesh",
+ "properties_data_metaball",
+ "properties_data_modifier",
+ "properties_game",
+ "properties_material",
+ "properties_object_constraint",
+ "properties_object",
+ "properties_particle",
+ "properties_physics_cloth",
+ "properties_physics_common",
+ "properties_physics_field",
+ "properties_physics_fluid",
+ "properties_physics_smoke",
+ "properties_physics_softbody",
+ "properties_render",
+ "properties_scene",
+ "properties_texture",
+ "properties_world",
+ "space_console",
+ "space_dopesheet",
+ "space_filebrowser",
+ "space_graph",
+ "space_image",
+ "space_info",
+ "space_logic",
+ "space_nla",
+ "space_node",
+ "space_outliner",
+ "space_sequencer",
+ "space_text",
+ "space_time",
+ "space_userpref_keymap",
+ "space_userpref",
+ "space_view3d",
+ "space_view3d_toolbar",
+)
+__import__(name=__name__, fromlist=_modules)
+_namespace = globals()
+_modules_loaded = {name: _namespace[name] for name in _modules}
+del _namespace
+
+
+import bpy
+
+
+def register():
+ bpy.utils.register_module(__name__)
+
+ # space_userprefs.py
+ from bpy.props import StringProperty, EnumProperty
+ WindowManager = bpy.types.WindowManager
+
+ WindowManager.addon_search = StringProperty(name="Search", description="Search within the selected filter")
+ WindowManager.addon_filter = EnumProperty(
+ items=[('All', "All", ""),
+ ('Enabled', "Enabled", ""),
+ ('Disabled', "Disabled", ""),
+ ('3D View', "3D View", ""),
+ ('Add Curve', "Add Curve", ""),
+ ('Add Mesh', "Add Mesh", ""),
+ ('Animation', "Animation", ""),
+ ('Development', "Development", ""),
+ ('Game Engine', "Game Engine", ""),
+ ('Import-Export', "Import-Export", ""),
+ ('Mesh', "Mesh", ""),
+ ('Object', "Object", ""),
+ ('Render', "Render", ""),
+ ('Rigging', "Rigging", ""),
+ ('System', "System", "")
+ ],
+ name="Category",
+ description="Filter add-ons by category",
+ )
+
+ WindowManager.addon_support = EnumProperty(
+ items=[('OFFICIAL', "Official", ""),
+ ('COMMUNITY', 'Community', ""),
+ ],
+ name="Support",
+ description="Display support level", default={'OFFICIAL', 'COMMUNITY'}, options={'ENUM_FLAG'})
+ # done...
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
diff --git a/release/scripts/startup/bl_ui/properties_animviz.py b/release/scripts/startup/bl_ui/properties_animviz.py
new file mode 100644
index 00000000000..ac25c643cab
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_animviz.py
@@ -0,0 +1,96 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+# Generic Panels (Independent of DataType)
+
+# NOTE:
+# The specialised panel types are derived in their respective UI modules
+# dont register these classes since they are only helpers.
+
+
+class MotionPathButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_label = "Motion Paths"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw_settings(self, context, avs, bones=False):
+ layout = self.layout
+
+ mps = avs.motion_path
+
+ layout.prop(mps, "type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column(align=True)
+ if (mps.type == 'CURRENT_FRAME'):
+ sub.prop(mps, "frame_before", text="Before")
+ sub.prop(mps, "frame_after", text="After")
+ elif (mps.type == 'RANGE'):
+ sub.prop(mps, "frame_start", text="Start")
+ sub.prop(mps, "frame_end", text="End")
+
+ sub.prop(mps, "frame_step", text="Step")
+ if bones:
+ col.row().prop(mps, "bake_location", expand=True)
+
+ col = split.column()
+ col.label(text="Display:")
+ col.prop(mps, "show_frame_numbers", text="Frame Numbers")
+ col.prop(mps, "show_keyframe_highlight", text="Keyframes")
+ if bones:
+ col.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes")
+ col.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
+
+
+# FIXME: this panel still needs to be ported so that it will work correctly with animviz
+class OnionSkinButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_label = "Onion Skinning"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ arm = context.armature
+
+ layout.prop(arm, "ghost_type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+
+ sub = col.column(align=True)
+ if arm.ghost_type == 'RANGE':
+ sub.prop(arm, "ghost_frame_start", text="Start")
+ sub.prop(arm, "ghost_frame_end", text="End")
+ sub.prop(arm, "ghost_size", text="Step")
+ elif arm.ghost_type == 'CURRENT_FRAME':
+ sub.prop(arm, "ghost_step", text="Range")
+ sub.prop(arm, "ghost_size", text="Step")
+
+ col = split.column()
+ col.label(text="Display:")
+ col.prop(arm, "show_only_ghost_selected", text="Selected Only")
diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py
new file mode 100644
index 00000000000..7aa1dee2721
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_armature.py
@@ -0,0 +1,310 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+class ArmatureButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return context.armature
+
+
+class DATA_PT_context_arm(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ arm = context.armature
+ space = context.space_data
+
+ if ob:
+ layout.template_ID(ob, "data")
+ elif arm:
+ layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "Skeleton"
+
+ def draw(self, context):
+ layout = self.layout
+
+ arm = context.armature
+
+ layout.prop(arm, "pose_position", expand=True)
+
+ col = layout.column()
+ col.label(text="Layers:")
+ col.prop(arm, "layers", text="")
+ col.label(text="Protected Layers:")
+ col.prop(arm, "layers_protected", text="")
+
+ layout.label(text="Deform:")
+ flow = layout.column_flow()
+ flow.prop(arm, "use_deform_vertex_groups", text="Vertex Groups")
+ flow.prop(arm, "use_deform_envelopes", text="Envelopes")
+ flow.prop(arm, "use_deform_preserve_volume", text="Quaternion")
+
+
+class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ arm = context.armature
+
+ layout.prop(arm, "draw_type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(arm, "show_names", text="Names")
+ col.prop(arm, "show_axes", text="Axes")
+ col.prop(arm, "show_bone_custom_shapes", text="Shapes")
+
+ col = split.column()
+ col.prop(arm, "show_group_colors", text="Colors")
+ if ob:
+ col.prop(ob, "show_x_ray", text="X-Ray")
+ col.prop(arm, "use_deform_delay", text="Delay Refresh")
+
+
+class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "Bone Groups"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ pose = ob.pose
+
+ row = layout.row()
+ row.template_list(pose, "bone_groups", pose.bone_groups, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.active = (ob.proxy is None)
+ col.operator("pose.group_add", icon='ZOOMIN', text="")
+ col.operator("pose.group_remove", icon='ZOOMOUT', text="")
+
+ group = pose.bone_groups.active
+ if group:
+ col = layout.column()
+ col.active = (ob.proxy is None)
+ col.prop(group, "name")
+
+ split = layout.split()
+ split.active = (ob.proxy is None)
+
+ col = split.column()
+ col.prop(group, "color_set")
+ if group.color_set:
+ col = split.column()
+ sub = col.row(align=True)
+ sub.prop(group.colors, "normal", text="")
+ sub.prop(group.colors, "select", text="")
+ sub.prop(group.colors, "active", text="")
+
+ row = layout.row()
+ row.active = (ob.proxy is None)
+
+ sub = row.row(align=True)
+ sub.operator("pose.group_assign", text="Assign")
+ sub.operator("pose.group_unassign", text="Remove") # row.operator("pose.bone_group_remove_from", text="Remove")
+
+ sub = row.row(align=True)
+ sub.operator("pose.group_select", text="Select")
+ sub.operator("pose.group_deselect", text="Deselect")
+
+
+class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "Pose Library"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ poselib = ob.pose_library
+
+ layout.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
+
+ if poselib:
+ row = layout.row()
+ row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
+
+ col = row.column(align=True)
+ col.active = (poselib.library is None)
+
+ # invoke should still be used for 'add', as it is needed to allow
+ # add/replace options to be used properly
+ col.operator("poselib.pose_add", icon='ZOOMIN', text="")
+
+ col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
+
+ pose_marker_active = poselib.pose_markers.active
+
+ if pose_marker_active is not None:
+ col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = pose_marker_active.name
+ col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = poselib.pose_markers.active_index
+
+ layout.operator("poselib.action_sanitise")
+
+
+# TODO: this panel will soon be depreceated too
+class DATA_PT_ghost(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "Ghost"
+
+ def draw(self, context):
+ layout = self.layout
+
+ arm = context.armature
+
+ layout.prop(arm, "ghost_type", expand=True)
+
+ split = layout.split()
+
+ col = split.column(align=True)
+
+ if arm.ghost_type == 'RANGE':
+ col.prop(arm, "ghost_frame_start", text="Start")
+ col.prop(arm, "ghost_frame_end", text="End")
+ col.prop(arm, "ghost_size", text="Step")
+ elif arm.ghost_type == 'CURRENT_FRAME':
+ col.prop(arm, "ghost_step", text="Range")
+ col.prop(arm, "ghost_size", text="Step")
+
+ col = split.column()
+ col.label(text="Display:")
+ col.prop(arm, "show_only_ghost_selected", text="Selected Only")
+
+
+class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, bpy.types.Panel):
+ bl_label = "iTaSC parameters"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return (ob and ob.pose)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ itasc = ob.pose.ik_param
+
+ layout.prop(ob.pose, "ik_solver")
+
+ if itasc:
+ layout.prop(itasc, "mode", expand=True)
+ simulation = (itasc.mode == 'SIMULATION')
+ if simulation:
+ layout.label(text="Reiteration:")
+ layout.prop(itasc, "reiteration_method", expand=True)
+
+ row = layout.row()
+ row.active = not simulation or itasc.reiteration_method != 'NEVER'
+ row.prop(itasc, "precision")
+ row.prop(itasc, "iterations")
+
+ if simulation:
+ layout.prop(itasc, "use_auto_step")
+ row = layout.row()
+ if itasc.use_auto_step:
+ row.prop(itasc, "step_min", text="Min")
+ row.prop(itasc, "step_max", text="Max")
+ else:
+ row.prop(itasc, "step_count")
+
+ layout.prop(itasc, "solver")
+ if simulation:
+ layout.prop(itasc, "feedback")
+ layout.prop(itasc, "velocity_max")
+ if itasc.solver == 'DLS':
+ row = layout.row()
+ row.prop(itasc, "damping_max", text="Damp", slider=True)
+ row.prop(itasc, "damping_epsilon", text="Eps", slider=True)
+
+from bl_ui.properties_animviz import (
+ MotionPathButtonsPanel,
+ OnionSkinButtonsPanel,
+ )
+
+class DATA_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Bones Motion Paths"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
+
+ layout.separator()
+
+ split = layout.split()
+ split.operator("pose.paths_calculate", text="Calculate Paths")
+ split.operator("pose.paths_clear", text="Clear Paths")
+
+
+class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Bones Onion Skinning"
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ # XXX: include posemode check?
+ return (context.object) and (context.armature)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.pose.animation_visualisation, bones=True)
+
+
+class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Armature
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
new file mode 100644
index 00000000000..271d40642a2
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -0,0 +1,370 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class BoneButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "bone"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.bone or context.edit_bone)
+
+
+class BONE_PT_context_bone(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ bone = context.bone
+ if not bone:
+ bone = context.edit_bone
+
+ row = layout.row()
+ row.label(text="", icon='BONE_DATA')
+ row.prop(bone, "name", text="")
+
+
+class BONE_PT_transform(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Transform"
+
+ @classmethod
+ def poll(cls, context):
+ if context.edit_bone:
+ return True
+
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ bone = context.bone
+
+ if bone and ob:
+ pchan = ob.pose.bones[bone.name]
+
+ row = layout.row()
+ col = row.column()
+ col.prop(pchan, "location")
+ col.active = not (bone.parent and bone.use_connect)
+
+ col = row.column()
+ if pchan.rotation_mode == 'QUATERNION':
+ col.prop(pchan, "rotation_quaternion", text="Rotation")
+ elif pchan.rotation_mode == 'AXIS_ANGLE':
+ #col.label(text="Rotation")
+ #col.prop(pchan, "rotation_angle", text="Angle")
+ #col.prop(pchan, "rotation_axis", text="Axis")
+ col.prop(pchan, "rotation_axis_angle", text="Rotation")
+ else:
+ col.prop(pchan, "rotation_euler", text="Rotation")
+
+ row.column().prop(pchan, "scale")
+
+ layout.prop(pchan, "rotation_mode")
+
+ elif context.edit_bone:
+ bone = context.edit_bone
+ row = layout.row()
+ row.column().prop(bone, "head")
+ row.column().prop(bone, "tail")
+
+ col = row.column()
+ sub = col.column(align=True)
+ sub.label(text="Roll:")
+ sub.prop(bone, "roll", text="")
+ sub.label()
+ sub.prop(bone, "lock")
+
+
+class BONE_PT_transform_locks(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Transform Locks"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ bone = context.bone
+ pchan = ob.pose.bones[bone.name]
+
+ row = layout.row()
+ col = row.column()
+ col.prop(pchan, "lock_location")
+ col.active = not (bone.parent and bone.use_connect)
+
+ col = row.column()
+ if pchan.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}:
+ col.prop(pchan, "lock_rotations_4d", text="Lock Rotation")
+ if pchan.lock_rotations_4d:
+ col.prop(pchan, "lock_rotation_w", text="W")
+ col.prop(pchan, "lock_rotation", text="")
+ else:
+ col.prop(pchan, "lock_rotation", text="Rotation")
+
+ row.column().prop(pchan, "lock_scale")
+
+
+class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Relations"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ bone = context.bone
+ arm = context.armature
+ pchan = None
+
+ if ob and bone:
+ pchan = ob.pose.bones[bone.name]
+ elif bone is None:
+ bone = context.edit_bone
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Layers:")
+ col.prop(bone, "layers", text="")
+
+ col.separator()
+
+ if ob and pchan:
+ col.label(text="Bone Group:")
+ col.prop_search(pchan, "bone_group", ob.pose, "bone_groups", text="")
+
+ col = split.column()
+ col.label(text="Parent:")
+ if context.bone:
+ col.prop(bone, "parent", text="")
+ else:
+ col.prop_search(bone, "parent", arm, "edit_bones", text="")
+
+ sub = col.column()
+ sub.active = (bone.parent is not None)
+ sub.prop(bone, "use_connect")
+ sub.prop(bone, "use_inherit_rotation", text="Inherit Rotation")
+ sub.prop(bone, "use_inherit_scale", text="Inherit Scale")
+ sub = col.column()
+ sub.active = (not bone.parent or not bone.use_connect)
+ sub.prop(bone, "use_local_location", text="Local Location")
+
+
+class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+
+ @classmethod
+ def poll(cls, context):
+ return context.bone
+
+ def draw(self, context):
+ # note. this works ok in editmode but isnt
+ # all that useful so disabling for now.
+ layout = self.layout
+
+ ob = context.object
+ bone = context.bone
+ pchan = None
+
+ if ob and bone:
+ pchan = ob.pose.bones[bone.name]
+ elif bone is None:
+ bone = context.edit_bone
+
+ if bone:
+ split = layout.split()
+
+ col = split.column()
+ col.prop(bone, "show_wire", text="Wireframe")
+ col.prop(bone, "hide", text="Hide")
+
+ if pchan:
+ col = split.column()
+
+ col.label(text="Custom Shape:")
+ col.prop(pchan, "custom_shape", text="")
+ if pchan.custom_shape:
+ col.prop_search(pchan, "custom_shape_transform", ob.pose, "bones", text="At")
+
+
+class BONE_PT_inverse_kinematics(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Inverse Kinematics"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ return ob and ob.mode == 'POSE' and context.bone
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ bone = context.bone
+ pchan = ob.pose.bones[bone.name]
+
+ row = layout.row()
+ row.prop(ob.pose, "ik_solver")
+
+ split = layout.split(percentage=0.25)
+ split.prop(pchan, "lock_ik_x", icon='LOCKED' if pchan.lock_ik_x else 'UNLOCKED', text="X")
+ split.active = pchan.is_in_ik_chain
+ row = split.row()
+ row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
+ row.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_x", text="Limit")
+ sub.active = pchan.lock_ik_x == False and pchan.is_in_ik_chain
+ sub = split.row(align=True)
+ sub.prop(pchan, "ik_min_x", text="")
+ sub.prop(pchan, "ik_max_x", text="")
+ sub.active = pchan.lock_ik_x == False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
+ split.active = pchan.is_in_ik_chain
+ row = split.row()
+ row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
+ row.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_y", text="Limit")
+ sub.active = pchan.lock_ik_y == False and pchan.is_in_ik_chain
+
+ sub = split.row(align=True)
+ sub.prop(pchan, "ik_min_y", text="")
+ sub.prop(pchan, "ik_max_y", text="")
+ sub.active = pchan.lock_ik_y == False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
+ split.active = pchan.is_in_ik_chain
+ sub = split.row()
+ sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
+ sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ sub = split.row()
+
+ sub.prop(pchan, "use_ik_limit_z", text="Limit")
+ sub.active = pchan.lock_ik_z == False and pchan.is_in_ik_chain
+ sub = split.row(align=True)
+ sub.prop(pchan, "ik_min_z", text="")
+ sub.prop(pchan, "ik_max_z", text="")
+ sub.active = pchan.lock_ik_z == False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
+
+ split = layout.split(percentage=0.25)
+ split.label(text="Stretch:")
+ sub = split.row()
+ sub.prop(pchan, "ik_stretch", text="", slider=True)
+ sub.active = pchan.is_in_ik_chain
+
+ if ob.pose.ik_solver == 'ITASC':
+ split = layout.split()
+ col = split.column()
+ col.prop(pchan, "use_ik_rotation_control", text="Control Rotation")
+ col.active = pchan.is_in_ik_chain
+ col = split.column()
+ col.prop(pchan, "ik_rotation_weight", text="Weight", slider=True)
+ col.active = pchan.is_in_ik_chain
+ # not supported yet
+ #row = layout.row()
+ #row.prop(pchan, "use_ik_linear_control", text="Joint Size")
+ #row.prop(pchan, "ik_linear_weight", text="Weight", slider=True)
+
+
+class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
+ bl_label = "Deform"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw_header(self, context):
+ bone = context.bone
+
+ if not bone:
+ bone = context.edit_bone
+
+ self.layout.prop(bone, "use_deform", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ bone = context.bone
+
+ if not bone:
+ bone = context.edit_bone
+
+ layout.active = bone.use_deform
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Envelope:")
+
+ sub = col.column(align=True)
+ sub.prop(bone, "envelope_distance", text="Distance")
+ sub.prop(bone, "envelope_weight", text="Weight")
+ col.prop(bone, "use_envelope_multiply", text="Multiply")
+
+ sub = col.column(align=True)
+ sub.label(text="Radius:")
+ sub.prop(bone, "head_radius", text="Head")
+ sub.prop(bone, "tail_radius", text="Tail")
+
+ col = split.column()
+ col.label(text="Curved Bones:")
+
+ sub = col.column(align=True)
+ sub.prop(bone, "bbone_segments", text="Segments")
+ sub.prop(bone, "bbone_in", text="Ease In")
+ sub.prop(bone, "bbone_out", text="Ease Out")
+
+ col.label(text="Offset:")
+ col.prop(bone, "use_cyclic_offset")
+
+
+class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone
+
+ @property
+ def _context_path(self):
+ obj = bpy.context.object
+ if obj and obj.mode == 'POSE':
+ return "active_pose_bone"
+ else:
+ return "active_bone"
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
new file mode 100644
index 00000000000..6427e1c5180
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -0,0 +1,136 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class CameraButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ return context.camera and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_camera(CameraButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ cam = context.camera
+ space = context.space_data
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif cam:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
+ bl_label = "Lens"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ cam = context.camera
+
+ layout.prop(cam, "type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ if cam.type == 'PERSP':
+ if cam.lens_unit == 'MILLIMETERS':
+ col.prop(cam, "lens")
+ elif cam.lens_unit == 'DEGREES':
+ col.prop(cam, "angle")
+ col = split.column()
+ col.prop(cam, "lens_unit", text="")
+
+ elif cam.type == 'ORTHO':
+ col.prop(cam, "ortho_scale")
+
+ layout.prop(cam, "use_panorama")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Shift:")
+ col.prop(cam, "shift_x", text="X")
+ col.prop(cam, "shift_y", text="Y")
+
+ col = split.column(align=True)
+ col.label(text="Clipping:")
+ col.prop(cam, "clip_start", text="Start")
+ col.prop(cam, "clip_end", text="End")
+
+ layout.label(text="Depth of Field:")
+
+ split = layout.split()
+ split.prop(cam, "dof_object", text="")
+
+ col = split.column()
+
+ if cam.dof_object != None:
+ col.enabled = False
+ col.prop(cam, "dof_distance", text="Distance")
+
+
+class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ cam = context.camera
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(cam, "show_limits", text="Limits")
+ col.prop(cam, "show_mist", text="Mist")
+ col.prop(cam, "show_title_safe", text="Title Safe")
+ col.prop(cam, "show_name", text="Name")
+
+ col = split.column()
+ col.prop(cam, "draw_size", text="Size")
+ col.separator()
+ col.prop(cam, "show_passepartout", text="Passepartout")
+ sub = col.column()
+ sub.active = cam.show_passepartout
+ sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True)
+
+
+class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Camera
diff --git a/release/scripts/startup/bl_ui/properties_data_curve.py b/release/scripts/startup/bl_ui/properties_data_curve.py
new file mode 100644
index 00000000000..8f117cd0335
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_curve.py
@@ -0,0 +1,392 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class CurveButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type in {'CURVE', 'SURFACE', 'FONT'} and context.curve)
+
+
+class CurveButtonsPanelCurve(CurveButtonsPanel):
+ '''Same as above but for curves only'''
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'CURVE' and context.curve)
+
+
+class CurveButtonsPanelActive(CurveButtonsPanel):
+ '''Same as above but for curves only'''
+
+ @classmethod
+ def poll(cls, context):
+ curve = context.curve
+ return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
+
+
+class DATA_PT_context_curve(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ curve = context.curve
+ space = context.space_data
+
+ if ob:
+ layout.template_ID(ob, "data")
+ elif curve:
+ layout.template_ID(space, "pin_id") # XXX: broken
+
+
+class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = "Shape"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ curve = context.curve
+ is_surf = (ob.type == 'SURFACE')
+ is_curve = (ob.type == 'CURVE')
+ is_text = (ob.type == 'FONT')
+
+ if is_curve:
+ row = layout.row()
+ row.prop(curve, "dimensions", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Resolution:")
+ sub = col.column(align=True)
+ sub.prop(curve, "resolution_u", text="Preview U")
+ sub.prop(curve, "render_resolution_u", text="Render U")
+ if is_curve:
+ col.label(text="Twisting:")
+ col.prop(curve, "twist_mode", text="")
+ col.prop(curve, "twist_smooth", text="Smooth")
+ if is_text:
+ col.label(text="Display:")
+ col.prop(curve, "use_fast_edit", text="Fast Editing")
+
+ col = split.column()
+
+ if is_surf:
+ sub = col.column()
+ sub.label(text="")
+ sub = col.column(align=True)
+ sub.prop(curve, "resolution_v", text="Preview V")
+ sub.prop(curve, "render_resolution_v", text="Render V")
+
+ if (is_curve or is_text):
+ sub = col.column()
+ sub.active = (curve.bevel_object is None)
+ sub.label(text="Fill:")
+ sub.prop(curve, "use_fill_front")
+ sub.prop(curve, "use_fill_back")
+ sub.prop(curve, "use_fill_deform", text="Fill Deformed")
+
+ col.label(text="Textures:")
+ col.prop(curve, "use_uv_as_generated")
+ col.prop(curve, "use_auto_texspace")
+
+
+class DATA_PT_geometry_curve(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = "Geometry"
+
+ @classmethod
+ def poll(cls, context):
+ obj = context.object
+ if obj and obj.type == 'SURFACE':
+ return False
+
+ return context.curve
+
+ def draw(self, context):
+ layout = self.layout
+
+ curve = context.curve
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Modification:")
+ col.prop(curve, "offset")
+ col.prop(curve, "extrude")
+ col.label(text="Taper Object:")
+ col.prop(curve, "taper_object", text="")
+
+ col = split.column()
+ col.label(text="Bevel:")
+ col.prop(curve, "bevel_depth", text="Depth")
+ col.prop(curve, "bevel_resolution", text="Resolution")
+ col.label(text="Bevel Object:")
+ col.prop(curve, "bevel_object", text="")
+
+
+class DATA_PT_pathanim(CurveButtonsPanelCurve, bpy.types.Panel):
+ bl_label = "Path Animation"
+
+ def draw_header(self, context):
+ curve = context.curve
+
+ self.layout.prop(curve, "use_path", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ curve = context.curve
+
+ layout.active = curve.use_path
+
+ col = layout.column()
+ layout.prop(curve, "path_duration", text="Frames")
+ layout.prop(curve, "eval_time")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(curve, "use_path_follow")
+ col.prop(curve, "use_stretch")
+ col.prop(curve, "use_deform_bounds")
+
+ col = split.column()
+ col.prop(curve, "use_radius")
+ col.prop(curve, "use_time_offset", text="Offset Children")
+
+
+class DATA_PT_active_spline(CurveButtonsPanelActive, bpy.types.Panel):
+ bl_label = "Active Spline"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ curve = context.curve
+ act_spline = curve.splines.active
+ is_surf = (ob.type == 'SURFACE')
+ is_poly = (act_spline.type == 'POLY')
+
+ split = layout.split()
+
+ if is_poly:
+ # These settings are below but its easier to have
+ # poly's set aside since they use so few settings
+ col = split.column()
+ col.label(text="Cyclic:")
+ col.prop(act_spline, "use_smooth")
+ col = split.column()
+ col.prop(act_spline, "use_cyclic_u", text="U")
+
+ else:
+ col = split.column()
+ col.label(text="Cyclic:")
+ if act_spline.type == 'NURBS':
+ col.label(text="Bezier:")
+ col.label(text="Endpoint:")
+ col.label(text="Order:")
+
+ col.label(text="Resolution:")
+
+ col = split.column()
+ col.prop(act_spline, "use_cyclic_u", text="U")
+
+ if act_spline.type == 'NURBS':
+ sub = col.column()
+ # sub.active = (not act_spline.use_cyclic_u)
+ sub.prop(act_spline, "use_bezier_u", text="U")
+ sub.prop(act_spline, "use_endpoint_u", text="U")
+
+ sub = col.column()
+ sub.prop(act_spline, "order_u", text="U")
+ col.prop(act_spline, "resolution_u", text="U")
+
+ if is_surf:
+ col = split.column()
+ col.prop(act_spline, "use_cyclic_v", text="V")
+
+ # its a surface, assume its a nurb.
+ sub = col.column()
+ sub.active = (not act_spline.use_cyclic_v)
+ sub.prop(act_spline, "use_bezier_v", text="V")
+ sub.prop(act_spline, "use_endpoint_v", text="V")
+ sub = col.column()
+ sub.prop(act_spline, "order_v", text="V")
+ sub.prop(act_spline, "resolution_v", text="V")
+
+ if not is_surf:
+ split = layout.split()
+ col = split.column()
+ col.active = (curve.dimensions == '3D')
+
+ col.label(text="Interpolation:")
+ col.prop(act_spline, "tilt_interpolation", text="Tilt")
+ col.prop(act_spline, "radius_interpolation", text="Radius")
+
+ layout.prop(act_spline, "use_smooth")
+
+
+class DATA_PT_font(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = "Font"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'FONT' and context.curve)
+
+ def draw(self, context):
+ layout = self.layout
+
+ text = context.curve
+ char = context.curve.edit_format
+
+ row = layout.split(percentage=0.25)
+ row.label(text="Regular")
+ row.template_ID(text, "font", open="font.open", unlink="font.unlink")
+ row = layout.split(percentage=0.25)
+ row.label(text="Bold")
+ row.template_ID(text, "font_bold", open="font.open", unlink="font.unlink")
+ row = layout.split(percentage=0.25)
+ row.label(text="Italic")
+ row.template_ID(text, "font_italic", open="font.open", unlink="font.unlink")
+ row = layout.split(percentage=0.25)
+ row.label(text="Bold & Italic")
+ row.template_ID(text, "font_bold_italic", open="font.open", unlink="font.unlink")
+
+ #layout.prop(text, "font")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(text, "size", text="Size")
+ col = split.column()
+ col.prop(text, "shear")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Object Font:")
+ col.prop(text, "family", text="")
+
+ col = split.column()
+ col.label(text="Text on Curve:")
+ col.prop(text, "follow_curve", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ colsub = col.column(align=True)
+ colsub.label(text="Underline:")
+ colsub.prop(text, "underline_position", text="Position")
+ colsub.prop(text, "underline_height", text="Thickness")
+
+ col = split.column()
+ col.label(text="Character:")
+ col.prop(char, "use_bold")
+ col.prop(char, "use_italic")
+ col.prop(char, "use_underline")
+
+ row = layout.row()
+ row.prop(text, "small_caps_scale", text="Small Caps")
+ row.prop(char, "use_small_caps")
+
+
+class DATA_PT_paragraph(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = "Paragraph"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'FONT' and context.curve)
+
+ def draw(self, context):
+ layout = self.layout
+
+ text = context.curve
+
+ layout.label(text="Align:")
+ layout.prop(text, "align", expand=True)
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Spacing:")
+ col.prop(text, "space_character", text="Character")
+ col.prop(text, "space_word", text="Word")
+ col.prop(text, "space_line", text="Line")
+
+ col = split.column(align=True)
+ col.label(text="Offset:")
+ col.prop(text, "offset_x", text="X")
+ col.prop(text, "offset_y", text="Y")
+
+
+class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
+ bl_label = "Text Boxes"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'FONT' and context.curve)
+
+ def draw(self, context):
+ layout = self.layout
+
+ text = context.curve
+
+ split = layout.split()
+ col = split.column()
+ col.operator("font.textbox_add", icon='ZOOMIN')
+ col = split.column()
+
+ for i, box in enumerate(text.text_boxes):
+
+ boxy = layout.box()
+
+ row = boxy.row()
+
+ split = row.split()
+
+ col = split.column(align=True)
+
+ col.label(text="Dimensions:")
+ col.prop(box, "width", text="Width")
+ col.prop(box, "height", text="Height")
+
+ col = split.column(align=True)
+
+ col.label(text="Offset:")
+ col.prop(box, "x", text="X")
+ col.prop(box, "y", text="Y")
+
+ row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
+
+
+class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Curve
diff --git a/release/scripts/startup/bl_ui/properties_data_empty.py b/release/scripts/startup/bl_ui/properties_data_empty.py
new file mode 100644
index 00000000000..8b5c9f093a0
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_empty.py
@@ -0,0 +1,42 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class DataButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object and context.object.type == 'EMPTY')
+
+
+class DATA_PT_empty(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Empty"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ layout.prop(ob, "empty_draw_type", text="Display")
+ layout.prop(ob, "empty_draw_size", text="Size")
diff --git a/release/scripts/startup/bl_ui/properties_data_lamp.py b/release/scripts/startup/bl_ui/properties_data_lamp.py
new file mode 100644
index 00000000000..00919d64ca5
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_lamp.py
@@ -0,0 +1,386 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class LAMP_MT_sunsky_presets(bpy.types.Menu):
+ bl_label = "Sun & Sky Presets"
+ preset_subdir = "sunsky"
+ preset_operator = "script.execute_preset"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ draw = bpy.types.Menu.draw_preset
+
+
+class DataButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ return context.lamp and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_lamp(DataButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ lamp = context.lamp
+ space = context.space_data
+
+ split = layout.split(percentage=0.65)
+
+ texture_count = len(lamp.texture_slots.keys())
+
+ if ob:
+ split.template_ID(ob, "data")
+ elif lamp:
+ split.template_ID(space, "pin_id")
+
+ if texture_count != 0:
+ split.label(text=str(texture_count), icon='TEXTURE')
+
+
+class DATA_PT_preview(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ self.layout.template_preview(context.lamp)
+
+
+class DATA_PT_lamp(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Lamp"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp
+
+ layout.prop(lamp, "type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column()
+ sub.prop(lamp, "color", text="")
+ sub.prop(lamp, "energy")
+
+ if lamp.type in {'POINT', 'SPOT'}:
+ sub.label(text="Falloff:")
+ sub.prop(lamp, "falloff_type", text="")
+ sub.prop(lamp, "distance")
+
+ if lamp.falloff_type == 'LINEAR_QUADRATIC_WEIGHTED':
+ col.label(text="Attenuation Factors:")
+ sub = col.column(align=True)
+ sub.prop(lamp, "linear_attenuation", slider=True, text="Linear")
+ sub.prop(lamp, "quadratic_attenuation", slider=True, text="Quadratic")
+
+ col.prop(lamp, "use_sphere")
+
+ if lamp.type == 'AREA':
+ col.prop(lamp, "distance")
+ col.prop(lamp, "gamma")
+
+ col = split.column()
+ col.prop(lamp, "use_negative")
+ col.prop(lamp, "use_own_layer", text="This Layer Only")
+ col.prop(lamp, "use_specular")
+ col.prop(lamp, "use_diffuse")
+
+
+class DATA_PT_sunsky(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Sky & Atmosphere"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ lamp = context.lamp
+ engine = context.scene.render.engine
+ return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp.sky
+
+ row = layout.row(align=True)
+ row.prop(lamp, "use_sky")
+ row.menu("LAMP_MT_sunsky_presets", text=bpy.types.LAMP_MT_sunsky_presets.bl_label)
+ row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMIN")
+ row.operator("lamp.sunsky_preset_add", text="", icon="ZOOMOUT").remove_active = True
+
+ row = layout.row()
+ row.active = lamp.use_sky or lamp.use_atmosphere
+ row.prop(lamp, "atmosphere_turbidity", text="Turbidity")
+
+ split = layout.split()
+
+ col = split.column()
+ col.active = lamp.use_sky
+ col.label(text="Blending:")
+ sub = col.column()
+ sub.prop(lamp, "sky_blend_type", text="")
+ sub.prop(lamp, "sky_blend", text="Factor")
+
+ col.label(text="Color Space:")
+ sub = col.column()
+ sub.row().prop(lamp, "sky_color_space", expand=True)
+ sub.prop(lamp, "sky_exposure", text="Exposure")
+
+ col = split.column()
+ col.active = lamp.use_sky
+ col.label(text="Horizon:")
+ sub = col.column()
+ sub.prop(lamp, "horizon_brightness", text="Brightness")
+ sub.prop(lamp, "spread", text="Spread")
+
+ col.label(text="Sun:")
+ sub = col.column()
+ sub.prop(lamp, "sun_brightness", text="Brightness")
+ sub.prop(lamp, "sun_size", text="Size")
+ sub.prop(lamp, "backscattered_light", slider=True, text="Back Light")
+
+ layout.separator()
+
+ layout.prop(lamp, "use_atmosphere")
+
+ split = layout.split()
+
+ col = split.column()
+ col.active = lamp.use_atmosphere
+ col.label(text="Intensity:")
+ col.prop(lamp, "sun_intensity", text="Sun")
+ col.prop(lamp, "atmosphere_distance_factor", text="Distance")
+
+ col = split.column()
+ col.active = lamp.use_atmosphere
+ col.label(text="Scattering:")
+ sub = col.column(align=True)
+ sub.prop(lamp, "atmosphere_inscattering", slider=True, text="Inscattering")
+ sub.prop(lamp, "atmosphere_extinction", slider=True, text="Extinction")
+
+
+class DATA_PT_shadow(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Shadow"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ lamp = context.lamp
+ engine = context.scene.render.engine
+ return (lamp and lamp.type in {'POINT', 'SUN', 'SPOT', 'AREA'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp
+
+ layout.prop(lamp, "shadow_method", expand=True)
+
+ if lamp.shadow_method == 'NOSHADOW' and lamp.type == 'AREA':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Form factor sampling:")
+
+ sub = col.row(align=True)
+
+ if lamp.shape == 'SQUARE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ elif lamp.shape == 'RECTANGLE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
+
+ if lamp.shadow_method != 'NOSHADOW':
+ split = layout.split()
+
+ col = split.column()
+ col.prop(lamp, "shadow_color", text="")
+
+ col = split.column()
+ col.prop(lamp, "use_shadow_layer", text="This Layer Only")
+ col.prop(lamp, "use_only_shadow")
+
+ if lamp.shadow_method == 'RAY_SHADOW':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Sampling:")
+
+ if lamp.type in {'POINT', 'SUN', 'SPOT'}:
+ sub = col.row()
+
+ sub.prop(lamp, "shadow_ray_samples", text="Samples")
+ sub.prop(lamp, "shadow_soft_size", text="Soft Size")
+
+ elif lamp.type == 'AREA':
+ sub = col.row(align=True)
+
+ if lamp.shape == 'SQUARE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples")
+ elif lamp.shape == 'RECTANGLE':
+ sub.prop(lamp, "shadow_ray_samples_x", text="Samples X")
+ sub.prop(lamp, "shadow_ray_samples_y", text="Samples Y")
+
+ col.row().prop(lamp, "shadow_ray_sample_method", expand=True)
+
+ if lamp.shadow_ray_sample_method == 'ADAPTIVE_QMC':
+ layout.prop(lamp, "shadow_adaptive_threshold", text="Threshold")
+
+ if lamp.type == 'AREA' and lamp.shadow_ray_sample_method == 'CONSTANT_JITTERED':
+ row = layout.row()
+ row.prop(lamp, "use_umbra")
+ row.prop(lamp, "use_dither")
+ row.prop(lamp, "use_jitter")
+
+ elif lamp.shadow_method == 'BUFFER_SHADOW':
+ col = layout.column()
+ col.label(text="Buffer Type:")
+ col.row().prop(lamp, "shadow_buffer_type", expand=True)
+
+ if lamp.shadow_buffer_type in {'REGULAR', 'HALFWAY', 'DEEP'}:
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Filter Type:")
+ col.prop(lamp, "shadow_filter_type", text="")
+ sub = col.column(align=True)
+ sub.prop(lamp, "shadow_buffer_soft", text="Soft")
+ sub.prop(lamp, "shadow_buffer_bias", text="Bias")
+
+ col = split.column()
+ col.label(text="Sample Buffers:")
+ col.prop(lamp, "shadow_sample_buffers", text="")
+ sub = col.column(align=True)
+ sub.prop(lamp, "shadow_buffer_size", text="Size")
+ sub.prop(lamp, "shadow_buffer_samples", text="Samples")
+ if lamp.shadow_buffer_type == 'DEEP':
+ col.prop(lamp, "compression_threshold")
+
+ elif lamp.shadow_buffer_type == 'IRREGULAR':
+ layout.prop(lamp, "shadow_buffer_bias", text="Bias")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(lamp, "use_auto_clip_start", text="Autoclip Start")
+ sub = col.column()
+ sub.active = not lamp.use_auto_clip_start
+ sub.prop(lamp, "shadow_buffer_clip_start", text="Clip Start")
+
+ col = split.column()
+ col.prop(lamp, "use_auto_clip_end", text="Autoclip End")
+ sub = col.column()
+ sub.active = not lamp.use_auto_clip_end
+ sub.prop(lamp, "shadow_buffer_clip_end", text=" Clip End")
+
+
+class DATA_PT_area(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Area Shape"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ lamp = context.lamp
+ engine = context.scene.render.engine
+ return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp
+
+ col = layout.column()
+ col.row().prop(lamp, "shape", expand=True)
+ sub = col.row(align=True)
+
+ if (lamp.shape == 'SQUARE'):
+ sub.prop(lamp, "size")
+ elif (lamp.shape == 'RECTANGLE'):
+ sub.prop(lamp, "size", text="Size X")
+ sub.prop(lamp, "size_y", text="Size Y")
+
+
+class DATA_PT_spot(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Spot Shape"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ lamp = context.lamp
+ engine = context.scene.render.engine
+ return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ lamp = context.lamp
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column()
+ sub.prop(lamp, "spot_size", text="Size")
+ sub.prop(lamp, "spot_blend", text="Blend", slider=True)
+ col.prop(lamp, "use_square")
+ col.prop(lamp, "show_cone")
+
+ col = split.column()
+
+ col.prop(lamp, "use_halo")
+ sub = col.column(align=True)
+ sub.active = lamp.use_halo
+ sub.prop(lamp, "halo_intensity", text="Intensity")
+ if lamp.shadow_method == 'BUFFER_SHADOW':
+ sub.prop(lamp, "halo_step", text="Step")
+
+
+class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Falloff Curve"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ lamp = context.lamp
+ engine = context.scene.render.engine
+
+ return (lamp and lamp.type in {'POINT', 'SPOT'} and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ lamp = context.lamp
+
+ self.layout.template_curve_mapping(lamp, "falloff_curve")
+
+
+class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Lamp
diff --git a/release/scripts/startup/bl_ui/properties_data_lattice.py b/release/scripts/startup/bl_ui/properties_data_lattice.py
new file mode 100644
index 00000000000..5f2fa4b4920
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_lattice.py
@@ -0,0 +1,82 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return context.lattice
+
+
+class DATA_PT_context_lattice(DataButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ lat = context.lattice
+ space = context.space_data
+
+ split = layout.split(percentage=0.65)
+ if ob:
+ split.template_ID(ob, "data")
+ split.separator()
+ elif lat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+
+class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Lattice"
+
+ def draw(self, context):
+ layout = self.layout
+
+ lat = context.lattice
+
+ row = layout.row()
+ row.prop(lat, "points_u")
+ row.prop(lat, "interpolation_type_u", text="")
+
+ row = layout.row()
+ row.prop(lat, "points_v")
+ row.prop(lat, "interpolation_type_v", text="")
+
+ row = layout.row()
+ row.prop(lat, "points_w")
+ row.prop(lat, "interpolation_type_w", text="")
+
+ row = layout.row()
+ row.prop(lat, "use_outside")
+ row.prop_search(lat, "vertex_group", context.object, "vertex_groups", text="")
+
+
+class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Lattice
diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
new file mode 100644
index 00000000000..d6557fda8a2
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -0,0 +1,351 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class MESH_MT_vertex_group_specials(bpy.types.Menu):
+ bl_label = "Vertex Group Specials"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.vertex_group_sort", icon='SORTALPHA')
+ layout.operator("object.vertex_group_copy", icon='COPY_ID')
+ layout.operator("object.vertex_group_copy_to_linked", icon='LINK_AREA')
+ layout.operator("object.vertex_group_copy_to_selected", icon='LINK_AREA')
+ layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT')
+ layout.operator("object.vertex_group_remove", icon='X', text="Delete All").all = True
+
+
+class MESH_MT_shape_key_specials(bpy.types.Menu):
+ bl_label = "Shape Key Specials"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.shape_key_transfer", icon='COPY_ID') # icon is not ideal
+ layout.operator("object.join_shapes", icon='COPY_ID') # icon is not ideal
+ layout.operator("object.shape_key_mirror", icon='ARROW_LEFTRIGHT')
+
+
+class MeshButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ return context.mesh and (engine in cls.COMPAT_ENGINES)
+
+
+class DATA_PT_context_mesh(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ mesh = context.mesh
+ space = context.space_data
+
+ if ob:
+ layout.template_ID(ob, "data")
+ elif mesh:
+ layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Normals"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ mesh = context.mesh
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mesh, "use_auto_smooth")
+ sub = col.column()
+ sub.active = mesh.use_auto_smooth
+ sub.prop(mesh, "auto_smooth_angle", text="Angle")
+
+ split.prop(mesh, "show_double_sided")
+
+
+class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Settings"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ mesh = context.mesh
+
+ layout.prop(mesh, "texture_mesh")
+ layout.prop(mesh, "use_auto_texspace")
+
+
+class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Vertex Groups"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ obj = context.object
+ return (obj and obj.type in {'MESH', 'LATTICE'} and (engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ group = ob.vertex_groups.active
+
+ rows = 2
+ if group:
+ rows = 5
+
+ row = layout.row()
+ row.template_list(ob, "vertex_groups", ob.vertex_groups, "active_index", rows=rows)
+
+ col = row.column(align=True)
+ col.operator("object.vertex_group_add", icon='ZOOMIN', text="")
+ col.operator("object.vertex_group_remove", icon='ZOOMOUT', text="")
+ col.menu("MESH_MT_vertex_group_specials", icon='DOWNARROW_HLT', text="")
+ if group:
+ col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP'
+ col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+
+ if group:
+ row = layout.row()
+ row.prop(group, "name")
+
+ if ob.mode == 'EDIT' and len(ob.vertex_groups) > 0:
+ row = layout.row()
+
+ sub = row.row(align=True)
+ sub.operator("object.vertex_group_assign", text="Assign")
+ sub.operator("object.vertex_group_remove_from", text="Remove")
+
+ sub = row.row(align=True)
+ sub.operator("object.vertex_group_select", text="Select")
+ sub.operator("object.vertex_group_deselect", text="Deselect")
+
+ layout.prop(context.tool_settings, "vertex_group_weight", text="Weight")
+
+
+class DATA_PT_shape_keys(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Shape Keys"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ obj = context.object
+ return (obj and obj.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE'} and (engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ key = ob.data.shape_keys
+ kb = ob.active_shape_key
+
+ enable_edit = ob.mode != 'EDIT'
+ enable_edit_value = False
+
+ if ob.show_only_shape_key is False:
+ if enable_edit or (ob.type == 'MESH' and ob.use_shape_key_edit_mode):
+ enable_edit_value = True
+
+ row = layout.row()
+
+ rows = 2
+ if kb:
+ rows = 5
+ row.template_list(key, "keys", ob, "active_shape_key_index", rows=rows)
+
+ col = row.column()
+
+ sub = col.column(align=True)
+ sub.operator("object.shape_key_add", icon='ZOOMIN', text="")
+ sub.operator("object.shape_key_remove", icon='ZOOMOUT', text="")
+ sub.menu("MESH_MT_shape_key_specials", icon='DOWNARROW_HLT', text="")
+
+ if kb:
+ col.separator()
+
+ sub = col.column(align=True)
+ sub.operator("object.shape_key_move", icon='TRIA_UP', text="").type = 'UP'
+ sub.operator("object.shape_key_move", icon='TRIA_DOWN', text="").type = 'DOWN'
+
+ split = layout.split(percentage=0.4)
+ row = split.row()
+ row.enabled = enable_edit
+ row.prop(key, "use_relative")
+
+ row = split.row()
+ row.alignment = 'RIGHT'
+
+ sub = row.row(align=True)
+ subsub = sub.row(align=True)
+ subsub.active = enable_edit_value
+ subsub.prop(ob, "show_only_shape_key", text="")
+ subsub.prop(kb, "mute", text="")
+ sub.prop(ob, "use_shape_key_edit_mode", text="")
+
+ sub = row.row()
+ sub.operator("object.shape_key_clear", icon='X', text="")
+
+ row = layout.row()
+ row.prop(kb, "name")
+
+ if key.use_relative:
+ if ob.active_shape_key_index != 0:
+ row = layout.row()
+ row.active = enable_edit_value
+ row.prop(kb, "value")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.active = enable_edit_value
+ col.label(text="Range:")
+ col.prop(kb, "slider_min", text="Min")
+ col.prop(kb, "slider_max", text="Max")
+
+ col = split.column(align=True)
+ col.active = enable_edit_value
+ col.label(text="Blend:")
+ col.prop_search(kb, "vertex_group", ob, "vertex_groups", text="")
+ col.prop_search(kb, "relative_key", key, "keys", text="")
+
+ else:
+ row = layout.row()
+ row.active = enable_edit_value
+ row.prop(key, "slurph")
+
+
+class DATA_PT_uv_texture(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "UV Texture"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ me = context.mesh
+
+ row = layout.row()
+ col = row.column()
+
+ col.template_list(me, "uv_textures", me.uv_textures, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("mesh.uv_texture_add", icon='ZOOMIN', text="")
+ col.operator("mesh.uv_texture_remove", icon='ZOOMOUT', text="")
+
+ lay = me.uv_textures.active
+ if lay:
+ layout.prop(lay, "name")
+
+
+class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Texture Face"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+
+ return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH'
+
+ def draw(self, context):
+ layout = self.layout
+ col = layout.column()
+
+ me = context.mesh
+
+ tf = me.faces.active_tface
+
+ if tf:
+ if context.scene.render.engine != 'BLENDER_GAME':
+ col.label(text="Options only supported in Game Engine")
+
+ split = layout.split()
+ col = split.column()
+
+ col.prop(tf, "use_image")
+ col.prop(tf, "use_light")
+ col.prop(tf, "hide")
+ col.prop(tf, "use_collision")
+
+ col.prop(tf, "use_blend_shared")
+ col.prop(tf, "use_twoside")
+ col.prop(tf, "use_object_color")
+
+ col = split.column()
+
+ col.prop(tf, "use_halo")
+ col.prop(tf, "use_billboard")
+ col.prop(tf, "use_shadow_cast")
+ col.prop(tf, "use_bitmap_text")
+ col.prop(tf, "use_alpha_sort")
+
+ col = layout.column()
+ col.prop(tf, "blend_type")
+ else:
+ col.label(text="No UV Texture")
+
+
+class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
+ bl_label = "Vertex Colors"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ me = context.mesh
+
+ row = layout.row()
+ col = row.column()
+
+ col.template_list(me, "vertex_colors", me.vertex_colors, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("mesh.vertex_color_add", icon='ZOOMIN', text="")
+ col.operator("mesh.vertex_color_remove", icon='ZOOMOUT', text="")
+
+ lay = me.vertex_colors.active
+ if lay:
+ layout.prop(lay, "name")
+
+
+class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.Mesh
diff --git a/release/scripts/startup/bl_ui/properties_data_metaball.py b/release/scripts/startup/bl_ui/properties_data_metaball.py
new file mode 100644
index 00000000000..952df9f5e36
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_metaball.py
@@ -0,0 +1,118 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class DataButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "data"
+
+ @classmethod
+ def poll(cls, context):
+ return context.meta_ball
+
+
+class DATA_PT_context_metaball(DataButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ mball = context.meta_ball
+ space = context.space_data
+
+ if ob:
+ layout.template_ID(ob, "data")
+ elif mball:
+ layout.template_ID(space, "pin_id")
+
+
+class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Metaball"
+
+ def draw(self, context):
+ layout = self.layout
+
+ mball = context.meta_ball
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Resolution:")
+ sub = col.column(align=True)
+ sub.prop(mball, "resolution", text="View")
+ sub.prop(mball, "render_resolution", text="Render")
+
+ col = split.column()
+ col.label(text="Settings:")
+ col.prop(mball, "threshold", text="Threshold")
+
+ layout.label(text="Update:")
+ layout.prop(mball, "update_method", expand=True)
+
+
+class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
+ bl_label = "Active Element"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.meta_ball and context.meta_ball.elements.active)
+
+ def draw(self, context):
+ layout = self.layout
+
+ metaelem = context.meta_ball.elements.active
+
+ layout.prop(metaelem, "type")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Settings:")
+ col.prop(metaelem, "stiffness", text="Stiffness")
+ col.prop(metaelem, "use_negative", text="Negative")
+ col.prop(metaelem, "hide", text="Hide")
+
+ col = split.column(align=True)
+
+ if metaelem.type in {'CUBE', 'ELLIPSOID'}:
+ col.label(text="Size:")
+ col.prop(metaelem, "size_x", text="X")
+ col.prop(metaelem, "size_y", text="Y")
+ col.prop(metaelem, "size_z", text="Z")
+
+ elif metaelem.type == 'TUBE':
+ col.label(text="Size:")
+ col.prop(metaelem, "size_x", text="X")
+
+ elif metaelem.type == 'PLANE':
+ col.label(text="Size:")
+ col.prop(metaelem, "size_x", text="X")
+ col.prop(metaelem, "size_y", text="Y")
+
+
+class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object.data"
+ _property_type = bpy.types.MetaBall
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
new file mode 100644
index 00000000000..848779c05b1
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -0,0 +1,701 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class ModifierButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "modifier"
+
+
+class DATA_PT_modifiers(ModifierButtonsPanel, bpy.types.Panel):
+ bl_label = "Modifiers"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ layout.operator_menu_enum("object.modifier_add", "type")
+
+ for md in ob.modifiers:
+ box = layout.template_modifier(md)
+ if box:
+ # match enum type to our functions, avoids a lookup table.
+ getattr(self, md.type)(box, ob, md)
+
+ # the mt.type enum is (ab)used for a lookup on function names
+ # ...to avoid lengthy if statements
+ # so each type must have a function here.
+
+ def ARMATURE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(md, "object", text="")
+ col.prop(md, "use_deform_preserve_volume")
+
+ col = split.column()
+ col.label(text="Bind To:")
+ col.prop(md, "use_vertex_groups", text="Vertex Groups")
+ col.prop(md, "use_bone_envelopes", text="Bone Envelopes")
+
+ layout.separator()
+
+ row = layout.row()
+ row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ sub = row.row()
+ sub.active = bool(md.vertex_group)
+ sub.prop(md, "invert_vertex_group")
+
+ layout.prop(md, "use_multi_modifier")
+
+ def ARRAY(self, layout, ob, md):
+ layout.prop(md, "fit_type")
+
+ if md.fit_type == 'FIXED_COUNT':
+ layout.prop(md, "count")
+ elif md.fit_type == 'FIT_LENGTH':
+ layout.prop(md, "fit_length")
+ elif md.fit_type == 'FIT_CURVE':
+ layout.prop(md, "curve")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "use_constant_offset")
+ sub = col.column()
+ sub.active = md.use_constant_offset
+ sub.prop(md, "constant_offset_displace", text="")
+
+ col.separator()
+
+ col.prop(md, "use_merge_vertices", text="Merge")
+ sub = col.column()
+ sub.active = md.use_merge_vertices
+ sub.prop(md, "use_merge_vertices_cap", text="First Last")
+ sub.prop(md, "merge_threshold", text="Distance")
+
+ col = split.column()
+ col.prop(md, "use_relative_offset")
+ sub = col.column()
+ sub.active = md.use_relative_offset
+ sub.prop(md, "relative_offset_displace", text="")
+
+ col.separator()
+
+ col.prop(md, "use_object_offset")
+ sub = col.column()
+ sub.active = md.use_object_offset
+ sub.prop(md, "offset_object", text="")
+
+ layout.separator()
+
+ layout.prop(md, "start_cap")
+ layout.prop(md, "end_cap")
+
+ def BEVEL(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "width")
+
+ col = split.column()
+ col.prop(md, "use_only_vertices")
+
+ layout.label(text="Limit Method:")
+ layout.row().prop(md, "limit_method", expand=True)
+ if md.limit_method == 'ANGLE':
+ layout.prop(md, "angle_limit")
+ elif md.limit_method == 'WEIGHT':
+ layout.row().prop(md, "edge_weight_method", expand=True)
+
+ def BOOLEAN(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Operation:")
+ col.prop(md, "operation", text="")
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(md, "object", text="")
+
+ def BUILD(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "frame_start")
+ col.prop(md, "frame_duration")
+
+ col = split.column()
+ col.prop(md, "use_random_order")
+ sub = col.column()
+ sub.active = md.use_random_order
+ sub.prop(md, "seed")
+
+ def CAST(self, layout, ob, md):
+ split = layout.split(percentage=0.25)
+
+ split.label(text="Cast Type:")
+ split.prop(md, "cast_type", text="")
+
+ split = layout.split(percentage=0.25)
+
+ col = split.column()
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
+
+ col = split.column()
+ col.prop(md, "factor")
+ col.prop(md, "radius")
+ col.prop(md, "size")
+ col.prop(md, "use_radius_as_size")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ col = split.column()
+ col.label(text="Control Object:")
+ col.prop(md, "object", text="")
+ if md.object:
+ col.prop(md, "use_transform")
+
+ def CLOTH(self, layout, ob, md):
+ layout.label(text="See Cloth panel.")
+
+ def COLLISION(self, layout, ob, md):
+ layout.label(text="See Collision panel.")
+
+ def CURVE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(md, "object", text="")
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ layout.label(text="Deformation Axis:")
+ layout.row().prop(md, "deform_axis", expand=True)
+
+ def DECIMATE(self, layout, ob, md):
+ layout.prop(md, "ratio")
+ layout.label(text="Face Count: %s" % str(md.face_count))
+
+ def DISPLACE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Texture:")
+ col.template_ID(md, "texture", new="texture.new")
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ col = split.column()
+ col.label(text="Direction:")
+ col.prop(md, "direction", text="")
+ col.label(text="Texture Coordinates:")
+ col.prop(md, "texture_coords", text="")
+ if md.texture_coords == 'OBJECT':
+ layout.prop(md, "texture_coordinate_object", text="Object")
+ elif md.texture_coords == 'UV' and ob.type == 'MESH':
+ layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
+
+ layout.separator()
+
+ row = layout.row()
+ row.prop(md, "mid_level")
+ row.prop(md, "strength")
+
+ def EDGE_SPLIT(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "use_edge_angle", text="Edge Angle")
+ sub = col.column()
+ sub.active = md.use_edge_angle
+ sub.prop(md, "split_angle")
+
+ split.prop(md, "use_edge_sharp", text="Sharp Edges")
+
+ def EXPLODE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Vertex group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ sub = col.column()
+ sub.active = bool(md.vertex_group)
+ sub.prop(md, "protect")
+ col.label(text="Particle UV")
+ col.prop_search(md, "particle_uv", ob.data, "uv_textures", text="")
+
+ col = split.column()
+ col.prop(md, "use_edge_cut")
+ col.prop(md, "show_unborn")
+ col.prop(md, "show_alive")
+ col.prop(md, "show_dead")
+ col.prop(md, "use_size")
+
+ layout.operator("object.explode_refresh", text="Refresh")
+
+ def FLUID_SIMULATION(self, layout, ob, md):
+ layout.label(text="See Fluid panel.")
+
+ def HOOK(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(md, "object", text="")
+ if md.object and md.object.type == 'ARMATURE':
+ col.label(text="Bone:")
+ col.prop_search(md, "subtarget", md.object.data, "bones", text="")
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "falloff")
+ col.prop(md, "force", slider=True)
+
+ col = split.column()
+ col.operator("object.hook_reset", text="Reset")
+ col.operator("object.hook_recenter", text="Recenter")
+
+ if ob.mode == 'EDIT':
+ layout.separator()
+ row = layout.row()
+ row.operator("object.hook_select", text="Select")
+ row.operator("object.hook_assign", text="Assign")
+
+ def LATTICE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(md, "object", text="")
+
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ def MASK(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Mode:")
+ col.prop(md, "mode", text="")
+ col = split.column()
+ if md.mode == 'ARMATURE':
+ col.label(text="Armature:")
+ col.prop(md, "armature", text="")
+ elif md.mode == 'VERTEX_GROUP':
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ sub = col.column()
+ sub.active = bool(md.vertex_group)
+ sub.prop(md, "invert_vertex_group")
+
+ def MESH_DEFORM(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column()
+ sub.label(text="Object:")
+ sub.prop(md, "object", text="")
+ sub.active = not md.is_bound
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ sub = col.column()
+ sub.active = bool(md.vertex_group)
+ sub.prop(md, "invert_vertex_group")
+
+ layout.separator()
+
+ if md.is_bound:
+ layout.operator("object.meshdeform_bind", text="Unbind")
+ else:
+ layout.operator("object.meshdeform_bind", text="Bind")
+
+ row = layout.row()
+ row.prop(md, "precision")
+ row.prop(md, "use_dynamic_bind")
+
+ def MIRROR(self, layout, ob, md):
+ split = layout.split(percentage=0.25)
+
+ col = split.column()
+ col.label(text="Axis:")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
+
+ col = split.column()
+ col.label(text="Options:")
+ col.prop(md, "use_mirror_merge", text="Merge")
+ col.prop(md, "use_clip", text="Clipping")
+ col.prop(md, "use_mirror_vertex_groups", text="Vertex Groups")
+
+ col = split.column()
+ col.label(text="Textures:")
+ col.prop(md, "use_mirror_u", text="U")
+ col.prop(md, "use_mirror_v", text="V")
+
+ col = layout.column()
+
+ if md.use_mirror_merge == True:
+ col.prop(md, "merge_threshold")
+ col.label(text="Mirror Object:")
+ col.prop(md, "mirror_object", text="")
+
+ def MULTIRES(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
+
+ split = layout.split()
+ col = split.column()
+ col.prop(md, "levels", text="Preview")
+ col.prop(md, "sculpt_levels", text="Sculpt")
+ col.prop(md, "render_levels", text="Render")
+
+ col = split.column()
+
+ col.enabled = ob.mode != 'EDIT'
+ col.operator("object.multires_subdivide", text="Subdivide")
+ col.operator("object.multires_higher_levels_delete", text="Delete Higher")
+ col.operator("object.multires_reshape", text="Reshape")
+ col.operator("object.multires_base_apply", text="Apply Base")
+ col.prop(md, "show_only_control_edges")
+
+ layout.separator()
+
+ col = layout.column()
+ row = col.row()
+ if md.is_external:
+ row.operator("object.multires_external_pack", text="Pack External")
+ row.label()
+ row = col.row()
+ row.prop(md, "filepath", text="")
+ else:
+ row.operator("object.multires_external_save", text="Save External...")
+ row.label()
+
+ def PARTICLE_INSTANCE(self, layout, ob, md):
+ layout.prop(md, "object")
+ layout.prop(md, "particle_system_index", text="Particle System")
+
+ split = layout.split()
+ col = split.column()
+ col.label(text="Create From:")
+ col.prop(md, "use_normal")
+ col.prop(md, "use_children")
+ col.prop(md, "use_size")
+
+ col = split.column()
+ col.label(text="Show Particles When:")
+ col.prop(md, "show_alive")
+ col.prop(md, "show_unborn")
+ col.prop(md, "show_dead")
+
+ layout.separator()
+
+ layout.prop(md, "use_path", text="Create Along Paths")
+
+ split = layout.split()
+ split.active = md.use_path
+ col = split.column()
+ col.row().prop(md, "axis", expand=True)
+ col.prop(md, "use_preserve_shape")
+
+ col = split.column()
+ col.prop(md, "position", slider=True)
+ col.prop(md, "random_position", text="Random", slider=True)
+
+ def PARTICLE_SYSTEM(self, layout, ob, md):
+ layout.label(text="See Particle panel.")
+
+ def SCREW(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "axis")
+ col.prop(md, "object", text="AxisOb")
+ col.prop(md, "angle")
+ col.prop(md, "steps")
+ col.prop(md, "render_steps")
+
+ col = split.column()
+ row = col.row()
+ row.active = (md.object is None or md.use_object_screw_offset == False)
+ row.prop(md, "screw_offset")
+ row = col.row()
+ row.active = (md.object is not None)
+ row.prop(md, "use_object_screw_offset")
+ col.prop(md, "use_normal_calculate")
+ col.prop(md, "use_normal_flip")
+ col.prop(md, "iterations")
+
+ def SHRINKWRAP(self, layout, ob, md):
+ split = layout.split()
+ col = split.column()
+ col.label(text="Target:")
+ col.prop(md, "target", text="")
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "offset")
+ col.prop(md, "subsurf_levels")
+
+ col = split.column()
+ col.label(text="Mode:")
+ col.prop(md, "wrap_method", text="")
+
+ split = layout.split(percentage=0.25)
+
+ col = split.column()
+
+ if md.wrap_method == 'PROJECT':
+ col.label(text="Axis:")
+ col.prop(md, "use_project_x")
+ col.prop(md, "use_project_y")
+ col.prop(md, "use_project_z")
+
+ col = split.column()
+ col.label(text="Direction:")
+ col.prop(md, "use_negative_direction")
+ col.prop(md, "use_positive_direction")
+
+ col = split.column()
+
+ col.label(text="Cull Faces:")
+ col.prop(md, "cull_face", expand=True)
+
+ layout.label(text="Auxiliary Target:")
+ layout.prop(md, "auxiliary_target", text="")
+
+ elif md.wrap_method == 'NEAREST_SURFACEPOINT':
+ layout.prop(md, "use_keep_above_surface")
+
+ def SIMPLE_DEFORM(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Mode:")
+ col.prop(md, "deform_method", text="")
+
+ col = split.column()
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Origin:")
+ col.prop(md, "origin", text="")
+ sub = col.column()
+ sub.active = (md.origin is not None)
+ sub.prop(md, "use_relative")
+
+ col = split.column()
+ col.label(text="Deform:")
+ col.prop(md, "factor")
+ col.prop(md, "limits", slider=True)
+ if md.deform_method in {'TAPER', 'STRETCH'}:
+ col.prop(md, "lock_x")
+ col.prop(md, "lock_y")
+
+ def SMOKE(self, layout, ob, md):
+ layout.label(text="See Smoke panel.")
+
+ def SMOOTH(self, layout, ob, md):
+ split = layout.split(percentage=0.25)
+
+ col = split.column()
+ col.label(text="Axis:")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_z")
+
+ col = split.column()
+ col.prop(md, "factor")
+ col.prop(md, "iterations")
+ col.label(text="Vertex Group:")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ def SOFT_BODY(self, layout, ob, md):
+ layout.label(text="See Soft Body panel.")
+
+ def SOLIDIFY(self, layout, ob, md):
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "thickness")
+ col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+
+ col.label(text="Crease:")
+ col.prop(md, "edge_crease_inner", text="Inner")
+ col.prop(md, "edge_crease_outer", text="Outer")
+ col.prop(md, "edge_crease_rim", text="Rim")
+ col.label(text="Material Index Offset:")
+
+ col = split.column()
+
+ col.prop(md, "offset")
+ colsub = col.column()
+ colsub.active = bool(md.vertex_group)
+ colsub.prop(md, "invert_vertex_group", text="Invert")
+
+ col.prop(md, "use_even_offset")
+ col.prop(md, "use_quality_normals")
+
+ col.prop(md, "use_rim")
+ colsub = col.column()
+
+ colsub.label()
+ rowsub = colsub.split(align=True, percentage=0.4)
+ rowsub.prop(md, "material_offset", text="")
+ colsub = rowsub.row()
+ colsub.active = md.use_rim
+ colsub.prop(md, "material_offset_rim", text="Rim")
+
+ def SUBSURF(self, layout, ob, md):
+ layout.row().prop(md, "subdivision_type", expand=True)
+
+ split = layout.split()
+ col = split.column()
+ col.label(text="Subdivisions:")
+ col.prop(md, "levels", text="View")
+ col.prop(md, "render_levels", text="Render")
+
+ col = split.column()
+ col.label(text="Options:")
+ col.prop(md, "use_subsurf_uv")
+ col.prop(md, "show_only_control_edges")
+
+ def SURFACE(self, layout, ob, md):
+ layout.label(text="See Fields panel.")
+
+ def UV_PROJECT(self, layout, ob, md):
+ if ob.type == 'MESH':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Image:")
+ col.prop(md, "image", text="")
+
+ col = split.column()
+ col.label(text="UV Layer:")
+ col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="")
+
+ split = layout.split()
+ col = split.column()
+ col.prop(md, "use_image_override")
+ col.prop(md, "projector_count", text="Projectors")
+ for proj in md.projectors:
+ col.prop(proj, "object", text="")
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.prop(md, "aspect_x", text="Aspect X")
+ sub.prop(md, "aspect_y", text="Aspect Y")
+
+ sub = col.column(align=True)
+ sub.prop(md, "scale_x", text="Scale X")
+ sub.prop(md, "scale_y", text="Scale Y")
+
+ def WAVE(self, layout, ob, md):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Motion:")
+ col.prop(md, "use_x")
+ col.prop(md, "use_y")
+ col.prop(md, "use_cyclic")
+
+ col = split.column()
+ col.prop(md, "use_normal")
+ sub = col.column()
+ sub.active = md.use_normal
+ sub.prop(md, "use_normal_x", text="X")
+ sub.prop(md, "use_normal_y", text="Y")
+ sub.prop(md, "use_normal_z", text="Z")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Time:")
+ sub = col.column(align=True)
+ sub.prop(md, "time_offset", text="Offset")
+ sub.prop(md, "lifetime", text="Life")
+ col.prop(md, "damping_time", text="Damping")
+
+ col = split.column()
+ col.label(text="Position:")
+ sub = col.column(align=True)
+ sub.prop(md, "start_position_x", text="X")
+ sub.prop(md, "start_position_y", text="Y")
+ col.prop(md, "falloff_radius", text="Falloff")
+
+ layout.separator()
+
+ layout.prop(md, "start_position_object")
+ layout.prop_search(md, "vertex_group", ob, "vertex_groups")
+ split = layout.split(percentage=0.33)
+ col = split.column()
+ col.label(text="Texture")
+ col = split.column()
+ col.template_ID(md, "texture", new="texture.new")
+ layout.prop(md, "texture_coords")
+ if md.texture_coords == 'MAP_UV' and ob.type == 'MESH':
+ layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
+ elif md.texture_coords == 'OBJECT':
+ layout.prop(md, "texture_coords_object")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(md, "speed", slider=True)
+ col.prop(md, "height", slider=True)
+
+ col = split.column()
+ col.prop(md, "width", slider=True)
+ col.prop(md, "narrowness", slider=True)
diff --git a/release/scripts/startup/bl_ui/properties_game.py b/release/scripts/startup/bl_ui/properties_game.py
new file mode 100644
index 00000000000..d04f486cf1e
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_game.py
@@ -0,0 +1,498 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class PhysicsButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+
+class PHYSICS_PT_game_physics(PhysicsButtonsPanel, bpy.types.Panel):
+ bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ rd = context.scene.render
+ return ob and ob.game and (rd.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.active_object
+ game = ob.game
+ soft = ob.game.soft_body
+
+ layout.prop(game, "physics_type")
+ layout.separator()
+
+ #if game.physics_type == 'DYNAMIC':
+ if game.physics_type in {'DYNAMIC', 'RIGID_BODY'}:
+ split = layout.split()
+
+ col = split.column()
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible") # out of place but useful
+
+ col = split.column()
+ col.prop(game, "use_material_physics_fh")
+ col.prop(game, "use_rotate_from_normal")
+ col.prop(game, "use_sleep")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Attributes:")
+ col.prop(game, "mass")
+ col.prop(game, "radius")
+ col.prop(game, "form_factor")
+
+ col = split.column()
+ sub = col.column()
+ sub.prop(game, "use_anisotropic_friction")
+ subsub = sub.column()
+ subsub.active = game.use_anisotropic_friction
+ subsub.prop(game, "friction_coefficients", text="", slider=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Velocity:")
+ sub = col.column(align=True)
+ sub.prop(game, "velocity_min", text="Minimum")
+ sub.prop(game, "velocity_max", text="Maximum")
+
+ col = split.column()
+ col.label(text="Damping:")
+ sub = col.column(align=True)
+ sub.prop(game, "damping", text="Translation", slider=True)
+ sub.prop(game, "rotation_damping", text="Rotation", slider=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Lock Translation:")
+ col.prop(game, "lock_location_x", text="X")
+ col.prop(game, "lock_location_y", text="Y")
+ col.prop(game, "lock_location_z", text="Z")
+
+ col = split.column()
+ col.label(text="Lock Rotation:")
+ col.prop(game, "lock_rotation_x", text="X")
+ col.prop(game, "lock_rotation_y", text="Y")
+ col.prop(game, "lock_rotation_z", text="Z")
+
+ elif game.physics_type == 'SOFT_BODY':
+ col = layout.column()
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Attributes:")
+ col.prop(game, "mass")
+ col.prop(soft, "weld_threshold")
+ col.prop(soft, "location_iterations")
+ col.prop(soft, "linear_stiffness", slider=True)
+ col.prop(soft, "dynamic_friction", slider=True)
+ col.prop(soft, "collision_margin", slider=True)
+ col.prop(soft, "use_bending_constraints", text="Bending Constraints")
+
+ col = split.column()
+ col.prop(soft, "use_shape_match")
+ sub = col.column()
+ sub.active = soft.use_shape_match
+ sub.prop(soft, "shape_threshold", slider=True)
+
+ col.separator()
+
+ col.label(text="Cluster Collision:")
+ col.prop(soft, "use_cluster_rigid_to_softbody")
+ col.prop(soft, "use_cluster_soft_to_softbody")
+ sub = col.column()
+ sub.active = (soft.use_cluster_rigid_to_softbody or soft.use_cluster_soft_to_softbody)
+ sub.prop(soft, "cluster_iterations", text="Iterations")
+
+ elif game.physics_type == 'STATIC':
+ col = layout.column()
+ col.prop(game, "use_actor")
+ col.prop(game, "use_ghost")
+ col.prop(ob, "hide_render", text="Invisible")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Attributes:")
+ col.prop(game, "radius")
+
+ col = split.column()
+ sub = col.column()
+ sub.prop(game, "use_anisotropic_friction")
+ subsub = sub.column()
+ subsub.active = game.use_anisotropic_friction
+ subsub.prop(game, "friction_coefficients", text="", slider=True)
+
+ elif game.physics_type in {'SENSOR', 'INVISIBLE', 'NO_COLLISION', 'OCCLUDE'}:
+ layout.prop(ob, "hide_render", text="Invisible")
+
+
+class PHYSICS_PT_game_collision_bounds(PhysicsButtonsPanel, bpy.types.Panel):
+ bl_label = "Collision Bounds"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ game = context.object.game
+ rd = context.scene.render
+ return (game.physics_type in {'DYNAMIC', 'RIGID_BODY', 'SENSOR', 'SOFT_BODY', 'STATIC'}) and (rd.engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ game = context.active_object.game
+
+ self.layout.prop(game, "use_collision_bounds", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ game = context.active_object.game
+
+ layout.active = game.use_collision_bounds
+ layout.prop(game, "collision_bounds_type", text="Bounds")
+
+ row = layout.row()
+ row.prop(game, "collision_margin", text="Margin", slider=True)
+ row.prop(game, "use_collision_compound", text="Compound")
+
+
+class RenderButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "render"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (rd.engine in cls.COMPAT_ENGINES)
+
+
+class RENDER_PT_game(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Game"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ row = layout.row()
+ row.operator("view3d.game_start", text="Start")
+ row.label()
+
+
+class RENDER_PT_game_player(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Standalone Player"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+
+ layout.prop(gs, "show_fullscreen")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Resolution:")
+ sub = col.column(align=True)
+ sub.prop(gs, "resolution_x", slider=False, text="X")
+ sub.prop(gs, "resolution_y", slider=False, text="Y")
+
+ col = split.column()
+ col.label(text="Quality:")
+ sub = col.column(align=True)
+ sub.prop(gs, "depth", text="Bit Depth", slider=False)
+ sub.prop(gs, "frequency", text="FPS", slider=False)
+
+ # framing:
+ col = layout.column()
+ col.label(text="Framing:")
+ col.row().prop(gs, "frame_type", expand=True)
+ if gs.frame_type == 'LETTERBOX':
+ col.prop(gs, "frame_color", text="")
+
+
+class RENDER_PT_game_stereo(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Stereo"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+ stereo_mode = gs.stereo
+
+ # stereo options:
+ layout.prop(gs, "stereo", expand=True)
+
+ # stereo:
+ if stereo_mode == 'STEREO':
+ layout.prop(gs, "stereo_mode")
+ layout.prop(gs, "stereo_eye_separation")
+
+ # dome:
+ elif stereo_mode == 'DOME':
+ layout.prop(gs, "dome_mode", text="Dome Type")
+
+ dome_type = gs.dome_mode
+
+ split = layout.split()
+
+ if dome_type == 'FISHEYE' or \
+ dome_type == 'TRUNCATED_REAR' or \
+ dome_type == 'TRUNCATED_FRONT':
+
+ col = split.column()
+ col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+ col.prop(gs, "dome_angle", slider=True)
+
+ col = split.column()
+ col.prop(gs, "dome_tesselation", text="Tesselation")
+ col.prop(gs, "dome_tilt")
+
+ elif dome_type == 'PANORAM_SPH':
+ col = split.column()
+
+ col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+ col = split.column()
+ col.prop(gs, "dome_tesselation", text="Tesselation")
+
+ else: # cube map
+ col = split.column()
+ col.prop(gs, "dome_buffer_resolution", text="Resolution", slider=True)
+
+ col = split.column()
+
+ layout.prop(gs, "dome_text")
+
+
+class RENDER_PT_game_shading(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+
+ layout.prop(gs, "material_mode", expand=True)
+
+ if gs.material_mode == 'GLSL':
+ split = layout.split()
+
+ col = split.column()
+ col.prop(gs, "use_glsl_lights", text="Lights")
+ col.prop(gs, "use_glsl_shaders", text="Shaders")
+ col.prop(gs, "use_glsl_shadows", text="Shadows")
+
+ col = split.column()
+ col.prop(gs, "use_glsl_ramps", text="Ramps")
+ col.prop(gs, "use_glsl_nodes", text="Nodes")
+ col.prop(gs, "use_glsl_extra_textures", text="Extra Textures")
+
+
+class RENDER_PT_game_performance(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Performance"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+ row = layout.row()
+ row.prop(gs, "use_frame_rate")
+ row.prop(gs, "use_display_lists")
+
+
+class RENDER_PT_game_display(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+ flow = layout.column_flow()
+ flow.prop(gs, "show_debug_properties", text="Debug Properties")
+ flow.prop(gs, "show_framerate_profile", text="Framerate and Profile")
+ flow.prop(gs, "show_physics_visualization", text="Physics Visualization")
+ flow.prop(gs, "use_deprecation_warnings")
+ flow.prop(gs, "show_mouse", text="Mouse Cursor")
+
+
+class RENDER_PT_game_sound(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Sound"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+
+ layout.prop(scene, "audio_distance_model")
+
+ layout.prop(scene, "audio_doppler_speed", text="Speed")
+ layout.prop(scene, "audio_doppler_factor")
+
+
+class WorldButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "world"
+
+
+class WORLD_PT_game_context_world(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.scene) and (rd.use_game_engine)
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ world = context.world
+ space = context.space_data
+
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
+
+
+class WORLD_PT_game_world(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "World"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ world = context.world
+
+ row = layout.row()
+ row.column().prop(world, "horizon_color")
+ row.column().prop(world, "ambient_color")
+
+
+class WORLD_PT_game_mist(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Mist"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ world = context.world
+
+ self.layout.prop(world.mist_settings, "use_mist", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ world = context.world
+
+ layout.active = world.mist_settings.use_mist
+
+ row = layout.row()
+ row.prop(world.mist_settings, "start")
+ row.prop(world.mist_settings, "depth")
+
+
+class WORLD_PT_game_physics(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.scene
+ return (scene.world and scene.render.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+
+ layout.prop(gs, "physics_engine")
+ if gs.physics_engine != 'NONE':
+ layout.prop(gs, "physics_gravity", text="Gravity")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Physics Steps:")
+ sub = col.column(align=True)
+ sub.prop(gs, "physics_step_max", text="Max")
+ sub.prop(gs, "physics_step_sub", text="Substeps")
+ col.prop(gs, "fps", text="FPS")
+
+ col = split.column()
+ col.label(text="Logic Steps:")
+ col.prop(gs, "logic_step_max", text="Max")
+
+ col = layout.column()
+ col.prop(gs, "use_occlusion_culling", text="Occlusion Culling")
+ sub = col.column()
+ sub.active = gs.use_occlusion_culling
+ sub.prop(gs, "occlusion_culling_resolution", text="Resolution")
+
+ else:
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Physics Steps:")
+ col.prop(gs, "fps", text="FPS")
+
+ col = split.column()
+ col.label(text="Logic Steps:")
+ col.prop(gs, "logic_step_max", text="Max")
diff --git a/release/scripts/startup/bl_ui/properties_material.py b/release/scripts/startup/bl_ui/properties_material.py
new file mode 100644
index 00000000000..ff3153bbec9
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_material.py
@@ -0,0 +1,969 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+def active_node_mat(mat):
+ # TODO, 2.4x has a pipeline section, for 2.5 we need to communicate
+ # which settings from node-materials are used
+ if mat is not None:
+ mat_node = mat.active_node_material
+ if mat_node:
+ return mat_node
+ else:
+ return mat
+
+ return None
+
+
+def check_material(mat):
+ if mat is not None:
+ if mat.use_nodes:
+ if mat.active_node_material is not None:
+ return True
+ return False
+ return True
+ return False
+
+
+def simple_material(mat):
+ if (mat is not None) and (not mat.use_nodes):
+ return True
+ return False
+
+
+class MATERIAL_MT_sss_presets(bpy.types.Menu):
+ bl_label = "SSS Presets"
+ preset_subdir = "sss"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class MATERIAL_MT_specials(bpy.types.Menu):
+ bl_label = "Material Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.material_slot_copy", icon='COPY_ID')
+ layout.operator("material.copy", icon='COPYDOWN')
+ layout.operator("material.paste", icon='PASTEDOWN')
+
+
+class MaterialButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "material"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
+
+
+class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ # An exception, dont call the parent poll func because
+ # this manages materials for all engine types
+
+ engine = context.scene.render.engine
+ return (context.material or context.object) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material
+ ob = context.object
+ slot = context.material_slot
+ space = context.space_data
+
+ if ob:
+ row = layout.row()
+
+ row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("object.material_slot_add", icon='ZOOMIN', text="")
+ col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
+
+ col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
+
+ if ob.mode == 'EDIT':
+ row = layout.row(align=True)
+ row.operator("object.material_slot_assign", text="Assign")
+ row.operator("object.material_slot_select", text="Select")
+ row.operator("object.material_slot_deselect", text="Deselect")
+
+ split = layout.split(percentage=0.65)
+
+ if ob:
+ split.template_ID(ob, "active_material", new="material.new")
+ row = split.row()
+ if mat:
+ row.prop(mat, "use_nodes", icon="NODETREE", text="")
+
+ if slot:
+ row.prop(slot, "link", text="")
+ else:
+ row.label()
+ elif mat:
+ split.template_ID(space, "pin_id")
+ split.separator()
+
+ if mat:
+ layout.prop(mat, "type", expand=True)
+ if mat.use_nodes:
+ row = layout.row()
+ row.label(text="", icon='NODETREE')
+ if mat.active_node_material:
+ row.prop(mat.active_node_material, "name", text="")
+ else:
+ row.label(text="No material node selected")
+
+
+class MATERIAL_PT_preview(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ self.layout.template_preview(context.material)
+
+
+class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Render Pipeline Options"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (not simple_material(mat)) and (mat.type in {'SURFACE', 'WIRE', 'VOLUME'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self. layout
+
+ mat = context.material
+ mat_type = mat.type in {'SURFACE', 'WIRE'}
+
+ row = layout.row()
+ row.active = mat_type
+ row.prop(mat, "use_transparency")
+ sub = row.column()
+ sub.prop(mat, "offset_z")
+ sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+
+ row = layout.row()
+ row.active = mat.use_transparency or not mat_type
+ row.prop(mat, "transparency_method", expand=True)
+
+ layout.separator()
+
+ split = layout.split()
+ col = split.column()
+
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ sub = col.column()
+ sub.active = mat_type
+ sub.prop(mat, "use_sky")
+ sub.prop(mat, "invert_z")
+
+ col = split.column()
+ col.active = mat_type
+
+ col.prop(mat, "use_cast_shadows_only", text="Cast Only")
+ col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
+ col.prop(mat, "use_cast_buffer_shadows")
+ col.prop(mat, "use_cast_approximate")
+
+
+class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Diffuse"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "diffuse_color", text="")
+ sub = col.column()
+ sub.active = (not mat.use_shadeless)
+ sub.prop(mat, "diffuse_intensity", text="Intensity")
+
+ col = split.column()
+ col.active = (not mat.use_shadeless)
+ col.prop(mat, "diffuse_shader", text="")
+ col.prop(mat, "use_diffuse_ramp", text="Ramp")
+
+ col = layout.column()
+ col.active = (not mat.use_shadeless)
+ if mat.diffuse_shader == 'OREN_NAYAR':
+ col.prop(mat, "roughness")
+ elif mat.diffuse_shader == 'MINNAERT':
+ col.prop(mat, "darkness")
+ elif mat.diffuse_shader == 'TOON':
+ row = col.row()
+ row.prop(mat, "diffuse_toon_size", text="Size")
+ row.prop(mat, "diffuse_toon_smooth", text="Smooth")
+ elif mat.diffuse_shader == 'FRESNEL':
+ row = col.row()
+ row.prop(mat, "diffuse_fresnel", text="Fresnel")
+ row.prop(mat, "diffuse_fresnel_factor", text="Factor")
+
+ if mat.use_diffuse_ramp:
+ layout.separator()
+ layout.template_color_ramp(mat, "diffuse_ramp", expand=True)
+ layout.separator()
+
+ row = layout.row()
+ row.prop(mat, "diffuse_ramp_input", text="Input")
+ row.prop(mat, "diffuse_ramp_blend", text="Blend")
+
+ layout.prop(mat, "diffuse_ramp_factor", text="Factor")
+
+
+class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Specular"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ layout.active = (not mat.use_shadeless)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "specular_color", text="")
+ col.prop(mat, "specular_intensity", text="Intensity")
+
+ col = split.column()
+ col.prop(mat, "specular_shader", text="")
+ col.prop(mat, "use_specular_ramp", text="Ramp")
+
+ col = layout.column()
+ if mat.specular_shader in {'COOKTORR', 'PHONG'}:
+ col.prop(mat, "specular_hardness", text="Hardness")
+ elif mat.specular_shader == 'BLINN':
+ row = col.row()
+ row.prop(mat, "specular_hardness", text="Hardness")
+ row.prop(mat, "specular_ior", text="IOR")
+ elif mat.specular_shader == 'WARDISO':
+ col.prop(mat, "specular_slope", text="Slope")
+ elif mat.specular_shader == 'TOON':
+ row = col.row()
+ row.prop(mat, "specular_toon_size", text="Size")
+ row.prop(mat, "specular_toon_smooth", text="Smooth")
+
+ if mat.use_specular_ramp:
+ layout.separator()
+ layout.template_color_ramp(mat, "specular_ramp", expand=True)
+ layout.separator()
+
+ row = layout.row()
+ row.prop(mat, "specular_ramp_input", text="Input")
+ row.prop(mat, "specular_ramp_blend", text="Blend")
+
+ layout.prop(mat, "specular_ramp_factor", text="Factor")
+
+
+class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ if mat.type in {'SURFACE', 'WIRE'}:
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column()
+ sub.active = not mat.use_shadeless
+ sub.prop(mat, "emit")
+ sub.prop(mat, "ambient")
+ sub = col.column()
+ sub.prop(mat, "translucency")
+
+ col = split.column()
+ col.prop(mat, "use_shadeless")
+ sub = col.column()
+ sub.active = not mat.use_shadeless
+ sub.prop(mat, "use_tangent_shading")
+ sub.prop(mat, "use_cubic")
+
+
+class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Transparency"
+ # bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ mat = context.material
+
+ if simple_material(mat):
+ self.layout.prop(mat, "use_transparency", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ base_mat = context.material
+ mat = active_node_mat(context.material)
+ rayt = mat.raytrace_transparency
+
+ if simple_material(base_mat):
+ row = layout.row()
+ row.active = mat.use_transparency
+ row.prop(mat, "transparency_method", expand=True)
+
+ split = layout.split()
+ split.active = base_mat.use_transparency
+
+ col = split.column()
+ col.prop(mat, "alpha")
+ row = col.row()
+ row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
+ row.prop(mat, "specular_alpha", text="Specular")
+
+ col = split.column()
+ col.active = (not mat.use_shadeless)
+ col.prop(rayt, "fresnel")
+ sub = col.column()
+ sub.active = rayt.fresnel > 0
+ sub.prop(rayt, "fresnel_factor", text="Blend")
+
+ if base_mat.transparency_method == 'RAYTRACE':
+ layout.separator()
+ split = layout.split()
+ split.active = base_mat.use_transparency
+
+ col = split.column()
+ col.prop(rayt, "ior")
+ col.prop(rayt, "filter")
+ col.prop(rayt, "falloff")
+ col.prop(rayt, "depth_max")
+ col.prop(rayt, "depth")
+
+ col = split.column()
+ col.label(text="Gloss:")
+ col.prop(rayt, "gloss_factor", text="Amount")
+ sub = col.column()
+ sub.active = rayt.gloss_factor < 1.0
+ sub.prop(rayt, "gloss_threshold", text="Threshold")
+ sub.prop(rayt, "gloss_samples", text="Samples")
+
+
+class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Mirror"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ raym = active_node_mat(context.material).raytrace_mirror
+
+ self.layout.prop(raym, "use", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+ raym = mat.raytrace_mirror
+
+ layout.active = raym.use
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(raym, "reflect_factor")
+ col.prop(mat, "mirror_color", text="")
+
+ col = split.column()
+ col.prop(raym, "fresnel")
+ sub = col.column()
+ sub.active = raym.fresnel > 0
+ sub.prop(raym, "fresnel_factor", text="Blend")
+
+ split = layout.split()
+
+ col = split.column()
+ col.separator()
+ col.prop(raym, "depth")
+ col.prop(raym, "distance", text="Max Dist")
+ col.separator()
+ sub = col.split(percentage=0.4)
+ sub.active = raym.distance > 0.0
+ sub.label(text="Fade To:")
+ sub.prop(raym, "fade_to", text="")
+
+ col = split.column()
+ col.label(text="Gloss:")
+ col.prop(raym, "gloss_factor", text="Amount")
+ sub = col.column()
+ sub.active = raym.gloss_factor < 1.0
+ sub.prop(raym, "gloss_threshold", text="Threshold")
+ sub.prop(raym, "gloss_samples", text="Samples")
+ sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
+
+
+class MATERIAL_PT_sss(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Subsurface Scattering"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ mat = active_node_mat(context.material)
+ sss = mat.subsurface_scattering
+
+ self.layout.active = (not mat.use_shadeless)
+ self.layout.prop(sss, "use", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+ sss = mat.subsurface_scattering
+
+ layout.active = (sss.use) and (not mat.use_shadeless)
+
+ row = layout.row().split()
+ sub = row.row(align=True).split(percentage=0.75)
+ sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
+ sub.operator("material.sss_preset_add", text="", icon="ZOOMIN")
+ sub.operator("material.sss_preset_add", text="", icon="ZOOMOUT").remove_active = True
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(sss, "ior")
+ col.prop(sss, "scale")
+ col.prop(sss, "color", text="")
+ col.prop(sss, "radius", text="RGB Radius", expand=True)
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Blend:")
+ sub.prop(sss, "color_factor", text="Color")
+ sub.prop(sss, "texture_factor", text="Texture")
+ sub.label(text="Scattering Weight:")
+ sub.prop(sss, "front")
+ sub.prop(sss, "back")
+ col.separator()
+ col.prop(sss, "error_threshold", text="Error")
+
+
+class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Halo"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material # dont use node material
+ halo = mat.halo
+
+ def number_but(layout, toggle, number, name, color):
+ row = layout.row(align=True)
+ row.prop(halo, toggle, text="")
+ sub = row.column()
+ sub.active = getattr(halo, toggle)
+ sub.prop(halo, number, text=name)
+ if not color == "":
+ sub.prop(mat, color, text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "alpha")
+ col.prop(mat, "diffuse_color", text="")
+
+ col = split.column()
+ col.prop(halo, "size")
+ col.prop(halo, "hardness")
+ col.prop(halo, "add")
+
+ layout.label(text="Options:")
+
+ split = layout.split()
+ col = split.column()
+ col.prop(halo, "use_texture")
+ col.prop(halo, "use_vertex_normal")
+ col.prop(halo, "use_extreme_alpha")
+ col.prop(halo, "use_shaded")
+ col.prop(halo, "use_soft")
+
+ col = split.column()
+ number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
+ number_but(col, "use_lines", "line_count", "Lines", "specular_color")
+ number_but(col, "use_star", "star_tip_count", "Star tips", "")
+
+
+class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Flare"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ halo = context.material.halo
+
+ self.layout.prop(halo, "use_flare_mode", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material # dont use node material
+ halo = mat.halo
+
+ layout.active = halo.use_flare_mode
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(halo, "flare_size", text="Size")
+ col.prop(halo, "flare_boost", text="Boost")
+ col.prop(halo, "flare_seed", text="Seed")
+
+ col = split.column()
+ col.prop(halo, "flare_subflare_count", text="Subflares")
+ col.prop(halo, "flare_subflare_size", text="Subsize")
+
+
+class MATERIAL_PT_physics(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.material and (context.scene.render.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ phys = context.material.physics # dont use node material
+
+ split = layout.split()
+ row = split.row()
+ row.prop(phys, "friction")
+ row.prop(phys, "elasticity", slider=True)
+
+ row = layout.row()
+ row.label(text="Force Field:")
+
+ row = layout.row()
+ row.prop(phys, "fh_force")
+ row.prop(phys, "fh_damping", slider=True)
+
+ row = layout.row()
+ row.prop(phys, "fh_distance")
+ row.prop(phys, "use_fh_normal")
+
+
+class MATERIAL_PT_strand(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Strand"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type in {'SURFACE', 'WIRE', 'HALO'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material # dont use node material
+ tan = mat.strand
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Size:")
+ sub.prop(tan, "root_size", text="Root")
+ sub.prop(tan, "tip_size", text="Tip")
+ sub.prop(tan, "size_min", text="Minimum")
+ sub.prop(tan, "use_blender_units")
+ sub = col.column()
+ sub.active = (not mat.use_shadeless)
+ sub.prop(tan, "use_tangent_shading")
+ col.prop(tan, "shape")
+
+ col = split.column()
+ col.label(text="Shading:")
+ col.prop(tan, "width_fade")
+ ob = context.object
+ if ob and ob.type == 'MESH':
+ col.prop_search(tan, "uv_layer", ob.data, "uv_textures", text="")
+ else:
+ col.prop(tan, "uv_layer", text="")
+ col.separator()
+ sub = col.column()
+ sub.active = (not mat.use_shadeless)
+ sub.label("Surface diffuse:")
+ sub = col.column()
+ sub.prop(tan, "blend_distance", text="Distance")
+
+
+class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Options"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ base_mat = context.material
+ mat = active_node_mat(base_mat)
+
+ split = layout.split()
+
+ col = split.column()
+ if simple_material(base_mat):
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ col.prop(mat, "use_sky")
+ col.prop(mat, "use_mist")
+ if simple_material(base_mat):
+ col.prop(mat, "invert_z")
+ sub = col.row()
+ sub.prop(mat, "offset_z")
+ sub.active = mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
+ sub = col.column(align=True)
+ sub.label(text="Light Group:")
+ sub.prop(mat, "light_group", text="")
+ row = sub.row()
+ row.active = bool(mat.light_group)
+ row.prop(mat, "use_light_group_exclusive", text="Exclusive")
+
+ col = split.column()
+ col.prop(mat, "use_face_texture")
+ sub = col.column()
+ sub.active = mat.use_face_texture
+ sub.prop(mat, "use_face_texture_alpha")
+ col.separator()
+ col.prop(mat, "use_vertex_color_paint")
+ col.prop(mat, "use_vertex_color_light")
+ col.prop(mat, "use_object_color")
+
+
+class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Shadow"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ base_mat = context.material
+ mat = active_node_mat(base_mat)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(mat, "use_shadows", text="Receive")
+ col.prop(mat, "use_transparent_shadows", text="Receive Transparent")
+ if simple_material(base_mat):
+ col.prop(mat, "use_cast_shadows_only", text="Cast Only")
+ col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
+ col.prop(mat, "use_only_shadow", text="ShadowsOnly")
+ sub = col.column()
+ sub.active = mat.use_only_shadow
+ sub.prop(mat, "shadow_only_type", text="")
+
+ col = split.column()
+ if simple_material(base_mat):
+ col.prop(mat, "use_cast_buffer_shadows")
+ sub = col.column()
+ sub.active = mat.use_cast_buffer_shadows
+ sub.prop(mat, "shadow_buffer_bias", text="Buffer Bias")
+ col.prop(mat, "use_ray_shadow_bias", text="Auto Ray Bias")
+ sub = col.column()
+ sub.active = (not mat.use_ray_shadow_bias)
+ sub.prop(mat, "shadow_ray_bias", text="Ray Bias")
+ if simple_material(base_mat):
+ col.prop(mat, "use_cast_approximate")
+
+
+class MATERIAL_PT_transp_game(MaterialButtonsPanel, bpy.types.Panel):
+ bl_label = "Transparency"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ mat = context.material
+
+ if simple_material(mat):
+ self.layout.prop(mat, "use_transparency", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ base_mat = context.material
+ mat = active_node_mat(base_mat)
+
+ if simple_material(base_mat):
+ row = layout.row()
+ row.active = mat.use_transparency
+ row.prop(mat, "transparency_method", expand=True)
+
+ layout.prop(mat, "alpha")
+
+
+class VolumeButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "material"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
+
+
+class MATERIAL_PT_volume_density(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Density"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ vol = context.material.volume # dont use node material
+
+ row = layout.row()
+ row.prop(vol, "density")
+ row.prop(vol, "density_scale")
+
+
+class MATERIAL_PT_volume_shading(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ vol = context.material.volume # dont use node material
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(vol, "scattering")
+ col.prop(vol, "asymmetry")
+ col.prop(vol, "transmission_color")
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.prop(vol, "emission")
+ sub.prop(vol, "emission_color", text="")
+ sub = col.column(align=True)
+ sub.prop(vol, "reflection")
+ sub.prop(vol, "reflection_color", text="")
+
+
+class MATERIAL_PT_volume_lighting(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Lighting"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ vol = context.material.volume # dont use node material
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(vol, "light_method", text="")
+
+ col = split.column()
+
+ if vol.light_method == 'SHADED':
+ col.prop(vol, "use_external_shadows")
+ col.prop(vol, "use_light_cache")
+ sub = col.column()
+ sub.active = vol.use_light_cache
+ sub.prop(vol, "cache_resolution")
+ elif vol.light_method in {'MULTIPLE_SCATTERING', 'SHADED_PLUS_MULTIPLE_SCATTERING'}:
+ sub = col.column()
+ sub.enabled = True
+ sub.active = False
+ sub.prop(vol, "use_light_cache")
+ col.prop(vol, "cache_resolution")
+
+ sub = col.column(align=True)
+ sub.prop(vol, "ms_diffusion")
+ sub.prop(vol, "ms_spread")
+ sub.prop(vol, "ms_intensity")
+
+
+class MATERIAL_PT_volume_transp(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Transparency"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return mat and simple_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = context.material # dont use node material
+
+ layout.prop(mat, "transparency_method", expand=True)
+
+
+class MATERIAL_PT_volume_integration(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Integration"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ vol = context.material.volume # dont use node material
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Step Calculation:")
+ col.prop(vol, "step_method", text="")
+ col = col.column(align=True)
+ col.prop(vol, "step_size")
+
+ col = split.column()
+ col.label()
+ col.prop(vol, "depth_threshold")
+
+
+class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
+ bl_label = "Options"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ mat = context.material
+ engine = context.scene.render.engine
+ return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ mat = active_node_mat(context.material)
+
+ split = layout.split()
+
+ col = split.column()
+ if simple_material(context.material):
+ col.prop(mat, "use_raytrace")
+ col.prop(mat, "use_full_oversampling")
+ col.prop(mat, "use_mist")
+
+ col = split.column()
+ col.label(text="Light Group:")
+ col.prop(mat, "light_group", text="")
+ row = col.row()
+ row.active = bool(mat.light_group)
+ row.prop(mat, "use_light_group_exclusive", text="Exclusive")
+
+
+class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "material"
+ _property_type = bpy.types.Material
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
new file mode 100644
index 00000000000..e906fc8d840
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -0,0 +1,337 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class ObjectButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "object"
+
+
+class OBJECT_PT_context_object(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+ space = context.space_data
+ ob = context.object
+
+ if space.use_pin_id:
+ layout.template_ID(space, "pin_id")
+ else:
+ row = layout.row()
+ row.label(text="", icon='OBJECT_DATA')
+ row.prop(ob, "name", text="")
+
+
+class OBJECT_PT_transform(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ row = layout.row()
+
+ row.column().prop(ob, "location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "rotation_angle", text="Angle")
+ #row.column().prop(pchan, "rotation_axis", text="Axis")
+ row.column().prop(ob, "rotation_axis_angle", text="Rotation")
+ else:
+ row.column().prop(ob, "rotation_euler", text="Rotation")
+
+ row.column().prop(ob, "scale")
+
+ layout.prop(ob, "rotation_mode")
+
+
+class OBJECT_PT_delta_transform(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Delta Transform"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ row = layout.row()
+
+ row.column().prop(ob, "delta_location")
+ if ob.rotation_mode == 'QUATERNION':
+ row.column().prop(ob, "delta_rotation_quaternion", text="Rotation")
+ elif ob.rotation_mode == 'AXIS_ANGLE':
+ #row.column().label(text="Rotation")
+ #row.column().prop(pchan, "delta_rotation_angle", text="Angle")
+ #row.column().prop(pchan, "delta_rotation_axis", text="Axis")
+ #row.column().prop(ob, "delta_rotation_axis_angle", text="Rotation")
+ row.column().label(text="Not for Axis-Angle")
+ else:
+ row.column().prop(ob, "delta_rotation_euler", text="Rotation")
+
+ row.column().prop(ob, "delta_scale")
+
+
+class OBJECT_PT_transform_locks(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Transform Locks"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ row = layout.row()
+
+ col = row.column()
+ col.prop(ob, "lock_location", text="Location")
+
+ col = row.column()
+ if ob.rotation_mode in {'QUATERNION', 'AXIS_ANGLE'}:
+ col.prop(ob, "lock_rotations_4d", text="Rotation")
+ if ob.lock_rotations_4d:
+ col.prop(ob, "lock_rotation_w", text="W")
+ col.prop(ob, "lock_rotation", text="")
+ else:
+ col.prop(ob, "lock_rotation", text="Rotation")
+
+ row.column().prop(ob, "lock_scale", text="Scale")
+
+
+class OBJECT_PT_relations(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Relations"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(ob, "layers")
+ col.separator()
+ col.prop(ob, "pass_index")
+
+ col = split.column()
+ col.label(text="Parent:")
+ col.prop(ob, "parent", text="")
+
+ sub = col.column()
+ sub.prop(ob, "parent_type", text="")
+ parent = ob.parent
+ if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
+ sub.prop_search(ob, "parent_bone", parent.data, "bones", text="")
+ sub.active = (parent is not None)
+
+
+class OBJECT_PT_groups(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Groups"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ row = layout.row(align=True)
+ row.operator("object.group_link", text="Add to Group")
+ row.operator("object.group_add", text="", icon='ZOOMIN')
+
+ # XXX, this is bad practice, yes, I wrote it :( - campbell
+ index = 0
+ value = str(tuple(context.scene.cursor_location))
+ for group in bpy.data.groups:
+ if ob.name in group.objects:
+ col = layout.column(align=True)
+
+ col.context_pointer_set("group", group)
+
+ row = col.box().row()
+ row.prop(group, "name", text="")
+ row.operator("object.group_remove", text="", icon='X', emboss=False)
+
+ split = col.box().split()
+
+ col = split.column()
+ col.prop(group, "layers", text="Dupli")
+
+ col = split.column()
+ col.prop(group, "dupli_offset", text="")
+
+ prop = col.operator("wm.context_set_value", text="From Cursor")
+ prop.data_path = "object.users_group[%d].dupli_offset" % index
+ prop.value = value
+ index += 1
+
+
+class OBJECT_PT_display(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ split = layout.split()
+ col = split.column()
+ col.prop(ob, "draw_type", text="Type")
+
+ col = split.column()
+ row = col.row()
+ row.prop(ob, "show_bounds", text="Bounds")
+ sub = row.row()
+ sub.active = ob.show_bounds
+ sub.prop(ob, "draw_bounds_type", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(ob, "show_name", text="Name")
+ col.prop(ob, "show_axis", text="Axis")
+ col.prop(ob, "show_wire", text="Wire")
+ col.prop(ob, "color", text="Object Color")
+
+ col = split.column()
+ col.prop(ob, "show_texture_space", text="Texture Space")
+ col.prop(ob, "show_x_ray", text="X-Ray")
+ if ob.type == 'MESH':
+ col.prop(ob, "show_transparent", text="Transparency")
+
+
+class OBJECT_PT_duplication(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Duplication"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ layout.prop(ob, "dupli_type", expand=True)
+
+ if ob.dupli_type == 'FRAMES':
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(ob, "dupli_frames_start", text="Start")
+ col.prop(ob, "dupli_frames_end", text="End")
+
+ col = split.column(align=True)
+ col.prop(ob, "dupli_frames_on", text="On")
+ col.prop(ob, "dupli_frames_off", text="Off")
+
+ layout.prop(ob, "use_dupli_frames_speed", text="Speed")
+
+ elif ob.dupli_type == 'VERTS':
+ layout.prop(ob, "use_dupli_vertices_rotation", text="Rotation")
+
+ elif ob.dupli_type == 'FACES':
+
+ row = layout.row()
+ row.prop(ob, "use_dupli_faces_scale", text="Scale")
+ row.prop(ob, "dupli_faces_scale", text="Inherit Scale")
+
+ elif ob.dupli_type == 'GROUP':
+ layout.prop(ob, "dupli_group", text="Group")
+
+
+# XXX: the following options are all quite buggy, ancient hacks that should be dropped
+
+class OBJECT_PT_animation(ObjectButtonsPanel, bpy.types.Panel):
+ bl_label = "Animation Hacks"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Time Offset:")
+ col.prop(ob, "use_time_offset_edit", text="Edit")
+ row = col.row()
+ row.prop(ob, "use_time_offset_parent", text="Parent")
+ row.active = (ob.parent is not None)
+ row = col.row()
+ row.prop(ob, "use_slow_parent")
+ row.active = (ob.parent is not None)
+ col.prop(ob, "time_offset", text="Offset")
+
+ # XXX: these are still used for a few curve-related tracking features
+ col = split.column()
+ col.label(text="Tracking Axes:")
+ col.prop(ob, "track_axis", text="Axis")
+ col.prop(ob, "up_axis", text="Up Axis")
+
+
+from bl_ui.properties_animviz import (
+ MotionPathButtonsPanel,
+ OnionSkinButtonsPanel,
+ )
+
+
+class OBJECT_PT_motion_paths(MotionPathButtonsPanel, bpy.types.Panel):
+ #bl_label = "Object Motion Paths"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+ layout.separator()
+
+ row = layout.row()
+ row.operator("object.paths_calculate", text="Calculate Paths")
+ row.operator("object.paths_clear", text="Clear Paths")
+
+
+class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # inherit from panel when ready
+ #bl_label = "Object Onion Skinning"
+ bl_context = "object"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ ob = context.object
+
+ self.draw_settings(context, ob.animation_visualisation)
+
+
+class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "object"
+ _property_type = bpy.types.Object
diff --git a/release/scripts/startup/bl_ui/properties_object_constraint.py b/release/scripts/startup/bl_ui/properties_object_constraint.py
new file mode 100644
index 00000000000..d182264e3dc
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_object_constraint.py
@@ -0,0 +1,781 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class ConstraintButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "constraint"
+
+ def draw_constraint(self, context, con):
+ layout = self.layout
+
+ box = layout.template_constraint(con)
+
+ if box:
+ # match enum type to our functions, avoids a lookup table.
+ getattr(self, con.type)(context, box, con)
+
+ if con.type not in {'RIGID_BODY_JOINT', 'NULL'}:
+ box.prop(con, "influence")
+
+ def space_template(self, layout, con, target=True, owner=True):
+ if target or owner:
+
+ split = layout.split(percentage=0.2)
+
+ split.label(text="Space:")
+ row = split.row()
+
+ if target:
+ row.prop(con, "target_space", text="")
+
+ if target and owner:
+ row.label(icon='ARROW_LEFTRIGHT')
+
+ if owner:
+ row.prop(con, "owner_space", text="")
+
+ def target_template(self, layout, con, subtargets=True):
+ layout.prop(con, "target") # XXX limiting settings for only 'curves' or some type of object
+
+ if con.target and subtargets:
+ if con.target.type == 'ARMATURE':
+ layout.prop_search(con, "subtarget", con.target.data, "bones", text="Bone")
+
+ if hasattr(con, "head_tail"):
+ row = layout.row()
+ row.label(text="Head/Tail:")
+ row.prop(con, "head_tail", text="")
+ elif con.target.type in {'MESH', 'LATTICE'}:
+ layout.prop_search(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
+
+ def ik_template(self, layout, con):
+ # only used for iTaSC
+ layout.prop(con, "pole_target")
+
+ if con.pole_target and con.pole_target.type == 'ARMATURE':
+ layout.prop_search(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
+
+ if con.pole_target:
+ row = layout.row()
+ row.label()
+ row.prop(con, "pole_angle")
+
+ split = layout.split(percentage=0.33)
+ col = split.column()
+ col.prop(con, "use_tail")
+ col.prop(con, "use_stretch")
+
+ col = split.column()
+ col.prop(con, "chain_count")
+ col.prop(con, "use_target")
+
+ def CHILD_OF(self, context, layout, con):
+ self.target_template(layout, con)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Location:")
+ col.prop(con, "use_location_x", text="X")
+ col.prop(con, "use_location_y", text="Y")
+ col.prop(con, "use_location_z", text="Z")
+
+ col = split.column()
+ col.label(text="Rotation:")
+ col.prop(con, "use_rotation_x", text="X")
+ col.prop(con, "use_rotation_y", text="Y")
+ col.prop(con, "use_rotation_z", text="Z")
+
+ col = split.column()
+ col.label(text="Scale:")
+ col.prop(con, "use_scale_x", text="X")
+ col.prop(con, "use_scale_y", text="Y")
+ col.prop(con, "use_scale_z", text="Z")
+
+ row = layout.row()
+ row.operator("constraint.childof_set_inverse")
+ row.operator("constraint.childof_clear_inverse")
+
+ def TRACK_TO(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
+
+ row = layout.row()
+ row.prop(con, "up_axis", text="Up")
+ row.prop(con, "use_target_z")
+
+ self.space_template(layout, con)
+
+ def IK(self, context, layout, con):
+ if context.object.pose.ik_solver == "ITASC":
+ layout.prop(con, "ik_type")
+ getattr(self, 'IK_' + con.ik_type)(context, layout, con)
+ else:
+ # Legacy IK constraint
+ self.target_template(layout, con)
+ layout.prop(con, "pole_target")
+
+ if con.pole_target and con.pole_target.type == 'ARMATURE':
+ layout.prop_search(con, "pole_subtarget", con.pole_target.data, "bones", text="Bone")
+
+ if con.pole_target:
+ row = layout.row()
+ row.prop(con, "pole_angle")
+ row.label()
+
+ split = layout.split()
+ col = split.column()
+ col.prop(con, "iterations")
+ col.prop(con, "chain_count")
+
+ col.label(text="Weight:")
+ col.prop(con, "weight", text="Position", slider=True)
+ sub = col.column()
+ sub.active = con.use_rotation
+ sub.prop(con, "orient_weight", text="Rotation", slider=True)
+
+ col = split.column()
+ col.prop(con, "use_tail")
+ col.prop(con, "use_stretch")
+ col.separator()
+ col.prop(con, "use_target")
+ col.prop(con, "use_rotation")
+
+ def IK_COPY_POSE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
+
+ row = layout.row()
+ row.label(text="Axis Ref:")
+ row.prop(con, "reference_axis", expand=True)
+ split = layout.split(percentage=0.33)
+ split.row().prop(con, "use_location")
+ row = split.row()
+ row.prop(con, "weight", text="Weight", slider=True)
+ row.active = con.use_location
+ split = layout.split(percentage=0.33)
+ row = split.row()
+ row.label(text="Lock:")
+ row = split.row()
+ row.prop(con, "lock_location_x", text="X")
+ row.prop(con, "lock_location_y", text="Y")
+ row.prop(con, "lock_location_z", text="Z")
+ split.active = con.use_location
+
+ split = layout.split(percentage=0.33)
+ split.row().prop(con, "use_rotation")
+ row = split.row()
+ row.prop(con, "orient_weight", text="Weight", slider=True)
+ row.active = con.use_rotation
+ split = layout.split(percentage=0.33)
+ row = split.row()
+ row.label(text="Lock:")
+ row = split.row()
+ row.prop(con, "lock_rotation_x", text="X")
+ row.prop(con, "lock_rotation_y", text="Y")
+ row.prop(con, "lock_rotation_z", text="Z")
+ split.active = con.use_rotation
+
+ def IK_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
+ self.ik_template(layout, con)
+
+ layout.prop(con, "limit_mode")
+
+ row = layout.row()
+ row.prop(con, "weight", text="Weight", slider=True)
+ row.prop(con, "distance", text="Distance", slider=True)
+
+ def FOLLOW_PATH(self, context, layout, con):
+ self.target_template(layout, con)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_curve_follow")
+ col.prop(con, "use_curve_radius")
+
+ col = split.column()
+ col.prop(con, "use_fixed_location")
+ if con.use_fixed_location:
+ col.prop(con, "offset_factor", text="Offset")
+ else:
+ col.prop(con, "offset")
+
+ row = layout.row()
+ row.label(text="Forward:")
+ row.prop(con, "forward_axis", expand=True)
+
+ row = layout.row()
+ row.prop(con, "up_axis", text="Up")
+ row.label()
+
+ def LIMIT_ROTATION(self, context, layout, con):
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_x")
+ sub = col.column()
+ sub.active = con.use_limit_x
+ sub.prop(con, "min_x", text="Min")
+ sub.prop(con, "max_x", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_y")
+ sub = col.column()
+ sub.active = con.use_limit_y
+ sub.prop(con, "min_y", text="Min")
+ sub.prop(con, "max_y", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_z")
+ sub = col.column()
+ sub.active = con.use_limit_z
+ sub.prop(con, "min_z", text="Min")
+ sub.prop(con, "max_z", text="Max")
+
+ row = layout.row()
+ row.prop(con, "use_transform_limit")
+ row.label()
+
+ row = layout.row()
+ row.label(text="Convert:")
+ row.prop(con, "owner_space", text="")
+
+ def LIMIT_LOCATION(self, context, layout, con):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_min_x")
+ sub = col.column()
+ sub.active = con.use_min_x
+ sub.prop(con, "min_x", text="")
+ col.prop(con, "use_max_x")
+ sub = col.column()
+ sub.active = con.use_max_x
+ sub.prop(con, "max_x", text="")
+
+ col = split.column()
+ col.prop(con, "use_min_y")
+ sub = col.column()
+ sub.active = con.use_min_y
+ sub.prop(con, "min_y", text="")
+ col.prop(con, "use_max_y")
+ sub = col.column()
+ sub.active = con.use_max_y
+ sub.prop(con, "max_y", text="")
+
+ col = split.column()
+ col.prop(con, "use_min_z")
+ sub = col.column()
+ sub.active = con.use_min_z
+ sub.prop(con, "min_z", text="")
+ col.prop(con, "use_max_z")
+ sub = col.column()
+ sub.active = con.use_max_z
+ sub.prop(con, "max_z", text="")
+
+ row = layout.row()
+ row.prop(con, "use_transform_limit")
+ row.label()
+
+ row = layout.row()
+ row.label(text="Convert:")
+ row.prop(con, "owner_space", text="")
+
+ def LIMIT_SCALE(self, context, layout, con):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_min_x")
+ sub = col.column()
+ sub.active = con.use_min_x
+ sub.prop(con, "min_x", text="")
+ col.prop(con, "use_max_x")
+ sub = col.column()
+ sub.active = con.use_max_x
+ sub.prop(con, "max_x", text="")
+
+ col = split.column()
+ col.prop(con, "use_min_y")
+ sub = col.column()
+ sub.active = con.use_min_y
+ sub.prop(con, "min_y", text="")
+ col.prop(con, "use_max_y")
+ sub = col.column()
+ sub.active = con.use_max_y
+ sub.prop(con, "max_y", text="")
+
+ col = split.column()
+ col.prop(con, "use_min_z")
+ sub = col.column()
+ sub.active = con.use_min_z
+ sub.prop(con, "min_z", text="")
+ col.prop(con, "use_max_z")
+ sub = col.column()
+ sub.active = con.use_max_z
+ sub.prop(con, "max_z", text="")
+
+ row = layout.row()
+ row.prop(con, "use_transform_limit")
+ row.label()
+
+ row = layout.row()
+ row.label(text="Convert:")
+ row.prop(con, "owner_space", text="")
+
+ def COPY_ROTATION(self, context, layout, con):
+ self.target_template(layout, con)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_x", text="X")
+ sub = col.column()
+ sub.active = con.use_x
+ sub.prop(con, "invert_x", text="Invert")
+
+ col = split.column()
+ col.prop(con, "use_y", text="Y")
+ sub = col.column()
+ sub.active = con.use_y
+ sub.prop(con, "invert_y", text="Invert")
+
+ col = split.column()
+ col.prop(con, "use_z", text="Z")
+ sub = col.column()
+ sub.active = con.use_z
+ sub.prop(con, "invert_z", text="Invert")
+
+ layout.prop(con, "use_offset")
+
+ self.space_template(layout, con)
+
+ def COPY_LOCATION(self, context, layout, con):
+ self.target_template(layout, con)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_x", text="X")
+ sub = col.column()
+ sub.active = con.use_x
+ sub.prop(con, "invert_x", text="Invert")
+
+ col = split.column()
+ col.prop(con, "use_y", text="Y")
+ sub = col.column()
+ sub.active = con.use_y
+ sub.prop(con, "invert_y", text="Invert")
+
+ col = split.column()
+ col.prop(con, "use_z", text="Z")
+ sub = col.column()
+ sub.active = con.use_z
+ sub.prop(con, "invert_z", text="Invert")
+
+ layout.prop(con, "use_offset")
+
+ self.space_template(layout, con)
+
+ def COPY_SCALE(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row(align=True)
+ row.prop(con, "use_x", text="X")
+ row.prop(con, "use_y", text="Y")
+ row.prop(con, "use_z", text="Z")
+
+ layout.prop(con, "use_offset")
+
+ self.space_template(layout, con)
+
+ def MAINTAIN_VOLUME(self, context, layout, con):
+
+ row = layout.row()
+ row.label(text="Free:")
+ row.prop(con, "free_axis", expand=True)
+
+ layout.prop(con, "volume")
+
+ self.space_template(layout, con)
+
+ def COPY_TRANSFORMS(self, context, layout, con):
+ self.target_template(layout, con)
+
+ self.space_template(layout, con)
+
+ #def SCRIPT(self, context, layout, con):
+
+ def ACTION(self, context, layout, con):
+ self.target_template(layout, con)
+
+ layout.prop(con, "action")
+
+ layout.prop(con, "transform_channel")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Action Length:")
+ col.prop(con, "frame_start", text="Start")
+ col.prop(con, "frame_end", text="End")
+
+ col = split.column(align=True)
+ col.label(text="Target Range:")
+ col.prop(con, "min", text="Min")
+ col.prop(con, "max", text="Max")
+
+ row = layout.row()
+ row.label(text="Convert:")
+ row.prop(con, "target_space", text="")
+
+ def LOCKED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
+
+ row = layout.row()
+ row.label(text="Lock:")
+ row.prop(con, "lock_axis", expand=True)
+
+ def LIMIT_DISTANCE(self, context, layout, con):
+ self.target_template(layout, con)
+
+ col = layout.column(align=True)
+ col.prop(con, "distance")
+ col.operator("constraint.limitdistance_reset")
+
+ row = layout.row()
+ row.label(text="Clamp Region:")
+ row.prop(con, "limit_mode", text="")
+
+ def STRETCH_TO(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.prop(con, "rest_length", text="Rest Length")
+ row.operator("constraint.stretchto_reset", text="Reset")
+
+ layout.prop(con, "bulge", text="Volume Variation")
+
+ row = layout.row()
+ row.label(text="Volume:")
+ row.prop(con, "volume", expand=True)
+
+ row.label(text="Plane:")
+ row.prop(con, "keep_axis", expand=True)
+
+ def FLOOR(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.prop(con, "use_sticky")
+ row.prop(con, "use_rotation")
+
+ layout.prop(con, "offset")
+
+ row = layout.row()
+ row.label(text="Min/Max:")
+ row.prop(con, "floor_location", expand=True)
+
+ self.space_template(layout, con)
+
+ def RIGID_BODY_JOINT(self, context, layout, con):
+ self.target_template(layout, con, subtargets=False)
+
+ layout.prop(con, "pivot_type")
+ layout.prop(con, "child")
+
+ row = layout.row()
+ row.prop(con, "use_linked_collision", text="Linked Collision")
+ row.prop(con, "show_pivot", text="Display Pivot")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Pivot:")
+ col.prop(con, "pivot_x", text="X")
+ col.prop(con, "pivot_y", text="Y")
+ col.prop(con, "pivot_z", text="Z")
+
+ col = split.column(align=True)
+ col.label(text="Axis:")
+ col.prop(con, "axis_x", text="X")
+ col.prop(con, "axis_y", text="Y")
+ col.prop(con, "axis_z", text="Z")
+
+ if con.pivot_type == 'CONE_TWIST':
+ layout.label(text="Limits:")
+ split = layout.split()
+
+ col = split.column()
+ col.prop(con, "use_angular_limit_x", text="Angle X")
+ sub = col.column()
+ sub.active = con.use_angular_limit_x
+ sub.prop(con, "limit_angle_max_x", text="")
+
+ col = split.column()
+ col.prop(con, "use_angular_limit_y", text="Angle Y")
+ sub = col.column()
+ sub.active = con.use_angular_limit_y
+ sub.prop(con, "limit_angle_max_y", text="")
+
+ col = split.column()
+ col.prop(con, "use_angular_limit_z", text="Angle Z")
+ sub = col.column()
+ sub.active = con.use_angular_limit_z
+ sub.prop(con, "limit_angle_max_z", text="")
+
+ elif con.pivot_type == 'GENERIC_6_DOF':
+ layout.label(text="Limits:")
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_x", text="X")
+ sub = col.column()
+ sub.active = con.use_limit_x
+ sub.prop(con, "limit_min_x", text="Min")
+ sub.prop(con, "limit_max_x", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_y", text="Y")
+ sub = col.column()
+ sub.active = con.use_limit_y
+ sub.prop(con, "limit_min_y", text="Min")
+ sub.prop(con, "limit_max_y", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_limit_z", text="Z")
+ sub = col.column()
+ sub.active = con.use_limit_z
+ sub.prop(con, "limit_min_z", text="Min")
+ sub.prop(con, "limit_max_z", text="Max")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_x", text="Angle X")
+ sub = col.column()
+ sub.active = con.use_angular_limit_x
+ sub.prop(con, "limit_angle_min_x", text="Min")
+ sub.prop(con, "limit_angle_max_x", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_y", text="Angle Y")
+ sub = col.column()
+ sub.active = con.use_angular_limit_y
+ sub.prop(con, "limit_angle_min_y", text="Min")
+ sub.prop(con, "limit_angle_max_y", text="Max")
+
+ col = split.column(align=True)
+ col.prop(con, "use_angular_limit_z", text="Angle Z")
+ sub = col.column()
+ sub.active = con.use_angular_limit_z
+ sub.prop(con, "limit_angle_min_z", text="Min")
+ sub.prop(con, "limit_angle_max_z", text="Max")
+
+ elif con.pivot_type == 'HINGE':
+ layout.label(text="Limits:")
+ split = layout.split()
+
+ row = split.row(align=True)
+ col = row.column()
+ col.prop(con, "use_angular_limit_x", text="Angle X")
+
+ col = row.column()
+ col.active = con.use_angular_limit_x
+ col.prop(con, "limit_angle_min_x", text="Min")
+ col = row.column()
+ col.active = con.use_angular_limit_x
+ col.prop(con, "limit_angle_max_x", text="Max")
+
+ def CLAMP_TO(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.label(text="Main Axis:")
+ row.prop(con, "main_axis", expand=True)
+
+ layout.prop(con, "use_cyclic")
+
+ def TRANSFORM(self, context, layout, con):
+ self.target_template(layout, con)
+
+ layout.prop(con, "use_motion_extrapolate", text="Extrapolate")
+
+ col = layout.column()
+ col.row().label(text="Source:")
+ col.row().prop(con, "map_from", expand=True)
+
+ split = layout.split()
+
+ sub = split.column(align=True)
+ sub.label(text="X:")
+ sub.prop(con, "from_min_x", text="Min")
+ sub.prop(con, "from_max_x", text="Max")
+
+ sub = split.column(align=True)
+ sub.label(text="Y:")
+ sub.prop(con, "from_min_y", text="Min")
+ sub.prop(con, "from_max_y", text="Max")
+
+ sub = split.column(align=True)
+ sub.label(text="Z:")
+ sub.prop(con, "from_min_z", text="Min")
+ sub.prop(con, "from_max_z", text="Max")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Destination:")
+ col.row().prop(con, "map_to", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="X:")
+ col.row().prop(con, "map_to_x_from", expand=True)
+
+ sub = col.column(align=True)
+ sub.prop(con, "to_min_x", text="Min")
+ sub.prop(con, "to_max_x", text="Max")
+
+ col = split.column()
+ col.label(text="Y:")
+ col.row().prop(con, "map_to_y_from", expand=True)
+
+ sub = col.column(align=True)
+ sub.prop(con, "to_min_y", text="Min")
+ sub.prop(con, "to_max_y", text="Max")
+
+ col = split.column()
+ col.label(text="Z:")
+ col.row().prop(con, "map_to_z_from", expand=True)
+
+ sub = col.column(align=True)
+ sub.prop(con, "to_min_z", text="Min")
+ sub.prop(con, "to_max_z", text="Max")
+
+ self.space_template(layout, con)
+
+ def SHRINKWRAP(self, context, layout, con):
+ self.target_template(layout, con, False)
+
+ layout.prop(con, "distance")
+ layout.prop(con, "shrinkwrap_type")
+
+ if con.shrinkwrap_type == 'PROJECT':
+ row = layout.row(align=True)
+ row.prop(con, "use_x")
+ row.prop(con, "use_y")
+ row.prop(con, "use_z")
+
+ def DAMPED_TRACK(self, context, layout, con):
+ self.target_template(layout, con)
+
+ row = layout.row()
+ row.label(text="To:")
+ row.prop(con, "track_axis", expand=True)
+
+ def SPLINE_IK(self, context, layout, con):
+ self.target_template(layout, con)
+
+ col = layout.column()
+ col.label(text="Spline Fitting:")
+ col.prop(con, "chain_count")
+ col.prop(con, "use_even_divisions")
+ col.prop(con, "use_chain_offset")
+
+ col = layout.column()
+ col.label(text="Chain Scaling:")
+ col.prop(con, "use_y_stretch")
+ col.prop(con, "xz_scale_mode")
+ col.prop(con, "use_curve_radius")
+
+ def PIVOT(self, context, layout, con):
+ self.target_template(layout, con)
+
+ if con.target:
+ col = layout.column()
+ col.prop(con, "offset", text="Pivot Offset")
+ else:
+ col = layout.column()
+ col.prop(con, "use_relative_location")
+ if con.use_relative_location:
+ col.prop(con, "offset", text="Relative Pivot Point")
+ else:
+ col.prop(con, "offset", text="Absolute Pivot Point")
+
+ col = layout.column()
+ col.prop(con, "rotation_range", text="Pivot When")
+
+ def SCRIPT(self, context, layout, con):
+ layout.label("Blender 2.5 has no py-constraints")
+
+
+class OBJECT_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
+ bl_label = "Object Constraints"
+ bl_context = "constraint"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+
+ if ob.mode == 'POSE':
+ box = layout.box()
+ box.alert = True
+ box.label(icon='INFO', text="See Bone Constraints tab to Add Constraints to active bone")
+ else:
+ layout.operator_menu_enum("object.constraint_add", "type")
+
+ for con in ob.constraints:
+ self.draw_constraint(context, con)
+
+
+class BONE_PT_constraints(ConstraintButtonsPanel, bpy.types.Panel):
+ bl_label = "Bone Constraints"
+ bl_context = "bone_constraint"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.pose_bone)
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_menu_enum("pose.constraint_add", "type")
+
+ for con in context.pose_bone.constraints:
+ self.draw_constraint(context, con)
diff --git a/release/scripts/startup/bl_ui/properties_particle.py b/release/scripts/startup/bl_ui/properties_particle.py
new file mode 100644
index 00000000000..9c678bd96b2
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -0,0 +1,1213 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+from bl_ui.properties_physics_common import (
+ point_cache_ui,
+ effector_weights_ui,
+ basic_force_field_settings_ui,
+ basic_force_field_falloff_ui,
+ )
+
+
+def particle_panel_enabled(context, psys):
+ if psys == None:
+ return True
+ phystype = psys.settings.physics_type
+ if psys.settings.type in {'EMITTER', 'REACTOR'} and phystype in {'NO', 'KEYED'}:
+ return True
+ else:
+ return (psys.point_cache.is_baked is False) and (not psys.is_edited) and (not context.particle_system_editable)
+
+
+def particle_panel_poll(cls, context):
+ psys = context.particle_system
+ engine = context.scene.render.engine
+ settings = 0
+
+ if psys:
+ settings = psys.settings
+ elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
+ settings = context.space_data.pin_id
+
+ if not settings:
+ return False
+
+ return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
+
+
+def particle_get_settings(context):
+ if context.particle_system:
+ return context.particle_system.settings
+ elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
+ return context.space_data.pin_id
+ return None
+
+
+class ParticleButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "particle"
+
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
+
+
+class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ return (context.particle_system or context.object or context.space_data.pin_id) and (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ psys = context.particle_system
+ part = 0
+
+ if ob:
+ row = layout.row()
+
+ row.template_list(ob, "particle_systems", ob.particle_systems, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("object.particle_system_add", icon='ZOOMIN', text="")
+ col.operator("object.particle_system_remove", icon='ZOOMOUT', text="")
+
+ if psys == None:
+ part = particle_get_settings(context)
+
+ if part == None:
+ return
+
+ layout.template_ID(context.space_data, "pin_id")
+
+ if part.is_fluid:
+ layout.label(text="Settings used for fluid.")
+ return
+
+ layout.prop(part, "type", text="Type")
+
+ elif not psys.settings:
+ split = layout.split(percentage=0.32)
+
+ col = split.column()
+ col.label(text="Name:")
+ col.label(text="Settings:")
+
+ col = split.column()
+ col.prop(psys, "name", text="")
+ col.template_ID(psys, "settings", new="particle.new")
+ else:
+ part = psys.settings
+
+ split = layout.split(percentage=0.32)
+ col = split.column()
+ col.label(text="Name:")
+ if part.is_fluid == False:
+ col.label(text="Settings:")
+ col.label(text="Type:")
+
+ col = split.column()
+ col.prop(psys, "name", text="")
+ if part.is_fluid == False:
+ row = col.row()
+ row.enabled = particle_panel_enabled(context, psys)
+ row.template_ID(psys, "settings", new="particle.new")
+
+ #row = layout.row()
+ #row.label(text="Viewport")
+ #row.label(text="Render")
+
+ if part.is_fluid:
+ layout.label(text=str(part.count) + " fluid particles for this frame.")
+ return
+
+ row = col.row()
+ row.enabled = particle_panel_enabled(context, psys)
+ row.prop(part, "type", text="")
+ row.prop(psys, "seed")
+
+ if part:
+ split = layout.split(percentage=0.65)
+ if part.type == 'HAIR':
+ if psys != None and psys.is_edited:
+ split.operator("particle.edited_clear", text="Free Edit")
+ else:
+ row = split.row()
+ row.enabled = particle_panel_enabled(context, psys)
+ row.prop(part, "regrow_hair")
+ row.prop(part, "use_advanced_hair")
+ row = split.row()
+ row.enabled = particle_panel_enabled(context, psys)
+ row.prop(part, "hair_step")
+ if psys != None and psys.is_edited:
+ if psys.is_global_hair:
+ layout.operator("particle.connect_hair")
+ layout.label(text="Hair is disconnected.")
+ else:
+ layout.operator("particle.disconnect_hair")
+ layout.label(text="")
+ elif psys != None and part.type == 'REACTOR':
+ split.enabled = particle_panel_enabled(context, psys)
+ split.prop(psys, "reactor_target_object")
+ split.prop(psys, "reactor_target_particle_system", text="Particle System")
+
+
+class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Emission"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ settings = particle_get_settings(context)
+
+ if settings is None:
+ return False
+ if settings.is_fluid:
+ return False
+ if particle_panel_poll(PARTICLE_PT_emission, context):
+ return psys == None or not context.particle_system.point_cache.use_external
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = particle_get_settings(context)
+
+ layout.enabled = particle_panel_enabled(context, psys) and (psys == None or not psys.has_multiple_caches)
+
+ row = layout.row()
+ row.active = part.distribution != 'GRID'
+ row.prop(part, "count")
+
+ if part.type == 'HAIR' and not part.use_advanced_hair:
+ row.prop(part, "hair_length")
+ return
+
+ if part.type != 'HAIR':
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(part, "frame_start")
+ col.prop(part, "frame_end")
+
+ col = split.column(align=True)
+ col.prop(part, "lifetime")
+ col.prop(part, "lifetime_random", slider=True)
+
+ layout.label(text="Emit From:")
+ layout.prop(part, "emit_from", expand=True)
+
+ row = layout.row()
+ if part.emit_from == 'VERT':
+ row.prop(part, "use_emit_random")
+ elif part.distribution == 'GRID':
+ row.prop(part, "invert_grid")
+ row.prop(part, "hexagonal_grid")
+ else:
+ row.prop(part, "use_emit_random")
+ row.prop(part, "use_even_distribution")
+
+ if part.emit_from == 'FACE' or part.emit_from == 'VOLUME':
+ layout.prop(part, "distribution", expand=True)
+
+ row = layout.row()
+ if part.distribution == 'JIT':
+ row.prop(part, "userjit", text="Particles/Face")
+ row.prop(part, "jitter_factor", text="Jittering Amount", slider=True)
+ elif part.distribution == 'GRID':
+ row.prop(part, "grid_resolution")
+ row.prop(part, "grid_random", text="Random", slider=True)
+
+
+class PARTICLE_PT_hair_dynamics(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Hair dynamics"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ engine = context.scene.render.engine
+ if psys is None:
+ return False
+ if psys.settings is None:
+ return False
+ return psys.settings.type == 'HAIR' and (engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ #cloth = context.cloth.collision_settings
+
+ #self.layout.active = cloth_panel_enabled(context.cloth)
+ #self.layout.prop(cloth, "use_collision", text="")
+ psys = context.particle_system
+ self.layout.prop(psys, "use_hair_dynamics", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+
+ if not psys.cloth:
+ return
+
+ cloth = psys.cloth.settings
+
+ layout.enabled = psys.use_hair_dynamics and psys.point_cache.is_baked == False
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Material:")
+ sub = col.column(align=True)
+ sub.prop(cloth, "pin_stiffness", text="Stiffness")
+ sub.prop(cloth, "mass")
+ sub.prop(cloth, "bending_stiffness", text="Bending")
+ sub.prop(cloth, "internal_friction", slider=True)
+ sub.prop(cloth, "collider_friction", slider=True)
+
+ col = split.column()
+ col.label(text="Damping:")
+ sub = col.column(align=True)
+ sub.prop(cloth, "spring_damping", text="Spring")
+ sub.prop(cloth, "air_damping", text="Air")
+
+ col.label(text="Quality:")
+ col.prop(cloth, "quality", text="Steps", slider=True)
+
+
+class PARTICLE_PT_cache(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Cache"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ engine = context.scene.render.engine
+ if psys is None:
+ return False
+ if psys.settings is None:
+ return False
+ if psys.settings.is_fluid:
+ return False
+ phystype = psys.settings.physics_type
+ if phystype == 'NO' or phystype == 'KEYED':
+ return False
+ return (psys.settings.type in {'EMITTER', 'REACTOR'} or (psys.settings.type == 'HAIR' and (psys.use_hair_dynamics or psys.point_cache.is_baked))) and engine in cls.COMPAT_ENGINES
+
+ def draw(self, context):
+ psys = context.particle_system
+
+ point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if (psys.settings.type == 'HAIR') else 'PSYS')
+
+
+class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Velocity"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_velocity, context):
+ psys = context.particle_system
+ settings = particle_get_settings(context)
+
+ if settings.type == 'HAIR' and not settings.use_advanced_hair:
+ return False
+ return settings.physics_type != 'BOIDS' and (psys == None or not psys.point_cache.use_external)
+ else:
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = particle_get_settings(context)
+
+ layout.enabled = particle_panel_enabled(context, psys)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Emitter Geometry:")
+ col.prop(part, "normal_factor")
+ sub = col.column(align=True)
+ sub.prop(part, "tangent_factor")
+ sub.prop(part, "tangent_phase", slider=True)
+
+ col = split.column()
+ col.label(text="Emitter Object")
+ col.prop(part, "object_align_factor", text="")
+
+ layout.label(text="Other:")
+ row = layout.row()
+ if part.emit_from == 'PARTICLE':
+ row.prop(part, "particle_factor")
+ else:
+ row.prop(part, "object_factor", slider=True)
+ row.prop(part, "factor_random")
+
+ #if part.type=='REACTOR':
+ # sub.prop(part, "reactor_factor")
+ # sub.prop(part, "reaction_shape", slider=True)
+
+
+class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Rotation"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_rotation, context):
+ psys = context.particle_system
+ settings = particle_get_settings(context)
+
+ if settings.type == 'HAIR' and not settings.use_advanced_hair:
+ return False
+ return settings.physics_type != 'BOIDS' and (psys == None or not psys.point_cache.use_external)
+ else:
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ if psys:
+ part = psys.settings
+ else:
+ part = context.space_data.pin_id
+
+ layout.enabled = particle_panel_enabled(context, psys)
+
+ row = layout.row()
+ row.label(text="Initial Rotation:")
+ row.prop(part, "use_dynamic_rotation")
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.prop(part, "rotation_mode", text="")
+ col.prop(part, "rotation_factor_random", slider=True, text="Random")
+
+ col = split.column(align=True)
+ col.prop(part, "phase_factor", slider=True)
+ col.prop(part, "phase_factor_random", text="Random", slider=True)
+
+ col = layout.column()
+ col.label(text="Angular Velocity:")
+ col.row().prop(part, "angular_velocity_mode", expand=True)
+
+ if part.angular_velocity_mode != 'NONE':
+ col.prop(part, "angular_velocity_factor", text="")
+
+
+class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Physics"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ if particle_panel_poll(PARTICLE_PT_physics, context):
+ psys = context.particle_system
+ settings = particle_get_settings(context)
+
+ if settings.type == 'HAIR' and not settings.use_advanced_hair:
+ return False
+ return psys == None or not psys.point_cache.use_external
+ else:
+ return False
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = particle_get_settings(context)
+
+ layout.enabled = particle_panel_enabled(context, psys)
+
+ layout.prop(part, "physics_type", expand=True)
+
+ row = layout.row()
+ col = row.column(align=True)
+ col.prop(part, "particle_size")
+ col.prop(part, "size_random", slider=True)
+
+ if part.physics_type != 'NO':
+ col = row.column(align=True)
+ col.prop(part, "mass")
+ col.prop(part, "use_multiply_size_mass", text="Multiply mass with size")
+
+ if part.physics_type in ('NEWTON', 'FLUID'):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Forces:")
+ col.prop(part, "brownian_factor")
+ col.prop(part, "drag_factor", slider=True)
+ col.prop(part, "damping", slider=True)
+
+ col = split.column()
+ col.label(text="Integration:")
+ col.prop(part, "integrator", text="")
+ col.prop(part, "timestep")
+ col.prop(part, "subframes")
+
+ row = layout.row()
+ row.prop(part, "use_size_deflect")
+ row.prop(part, "use_die_on_collision")
+
+ if part.physics_type == 'FLUID':
+ fluid = part.fluid
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Fluid properties:")
+ col.prop(fluid, "stiffness", text="Stiffness")
+ col.prop(fluid, "linear_viscosity", text="Viscosity")
+ col.prop(fluid, "buoyancy", text="Buoancy", slider=True)
+
+ col = split.column()
+ col.label(text="Advanced:")
+
+ sub = col.row()
+ sub.prop(fluid, "repulsion", slider=fluid.factor_repulsion)
+ sub.prop(fluid, "factor_repulsion", text="")
+
+ sub = col.row()
+ sub.prop(fluid, "stiff_viscosity", slider=fluid.factor_stiff_viscosity)
+ sub.prop(fluid, "factor_stiff_viscosity", text="")
+
+ sub = col.row()
+ sub.prop(fluid, "fluid_radius", slider=fluid.factor_radius)
+ sub.prop(fluid, "factor_radius", text="")
+
+ sub = col.row()
+ sub.prop(fluid, "rest_density", slider=fluid.factor_density)
+ sub.prop(fluid, "factor_density", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Springs:")
+ col.prop(fluid, "spring_force", text="Force")
+ col.prop(fluid, "use_viscoelastic_springs")
+ sub = col.column(align=True)
+ sub.active = fluid.use_viscoelastic_springs
+ sub.prop(fluid, "yield_ratio", slider=True)
+ sub.prop(fluid, "plasticity", slider=True)
+
+ col = split.column()
+ col.label(text="Advanced:")
+ sub = col.row()
+ sub.prop(fluid, "rest_length", slider=fluid.factor_rest_length)
+ sub.prop(fluid, "factor_rest_length", text="")
+ col.label(text="")
+ sub = col.column()
+ sub.active = fluid.use_viscoelastic_springs
+ sub.prop(fluid, "use_initial_rest_length")
+ sub.prop(fluid, "spring_frames", text="Frames")
+
+ elif part.physics_type == 'KEYED':
+ split = layout.split()
+ sub = split.column()
+
+ row = layout.row()
+ col = row.column()
+ col.active = not psys.use_keyed_timing
+ col.prop(part, "keyed_loops", text="Loops")
+ if psys:
+ row.prop(psys, "use_keyed_timing", text="Use Timing")
+
+ layout.label(text="Keys:")
+ elif part.physics_type == 'BOIDS':
+ boids = part.boids
+
+ row = layout.row()
+ row.prop(boids, "use_flight")
+ row.prop(boids, "use_land")
+ row.prop(boids, "use_climb")
+
+ split = layout.split()
+
+ sub = split.column()
+ col = sub.column(align=True)
+ col.active = boids.use_flight
+ col.prop(boids, "air_speed_max")
+ col.prop(boids, "air_speed_min", slider=True)
+ col.prop(boids, "air_acc_max", slider=True)
+ col.prop(boids, "air_ave_max", slider=True)
+ col.prop(boids, "air_personal_space")
+ row = col.row()
+ row.active = (boids.use_land or boids.use_climb) and boids.use_flight
+ row.prop(boids, "land_smooth")
+
+ sub = split.column()
+ col = sub.column(align=True)
+ col.active = boids.use_land or boids.use_climb
+ col.prop(boids, "land_speed_max")
+ col.prop(boids, "land_jump_speed")
+ col.prop(boids, "land_acc_max", slider=True)
+ col.prop(boids, "land_ave_max", slider=True)
+ col.prop(boids, "land_personal_space")
+ col.prop(boids, "land_stick_force")
+
+ row = layout.row()
+
+ col = row.column(align=True)
+ col.label(text="Battle:")
+ col.prop(boids, "health")
+ col.prop(boids, "strength")
+ col.prop(boids, "aggression")
+ col.prop(boids, "accuracy")
+ col.prop(boids, "range")
+
+ col = row.column()
+ col.label(text="Misc:")
+ col.prop(boids, "bank", slider=True)
+ col.prop(boids, "pitch", slider=True)
+ col.prop(boids, "height", slider=True)
+
+ if psys and part.physics_type in {'KEYED', 'BOIDS', 'FLUID'}:
+ if part.physics_type == 'BOIDS':
+ layout.label(text="Relations:")
+ elif part.physics_type == 'FLUID':
+ layout.label(text="Fluid interaction:")
+
+ row = layout.row()
+ row.template_list(psys, "targets", psys, "active_particle_target_index")
+
+ col = row.column()
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("particle.new_target", icon='ZOOMIN', text="")
+ subsub.operator("particle.target_remove", icon='ZOOMOUT', text="")
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("particle.target_move_up", icon='MOVE_UP_VEC', text="")
+ subsub.operator("particle.target_move_down", icon='MOVE_DOWN_VEC', text="")
+
+ key = psys.active_particle_target
+ if key:
+ row = layout.row()
+ if part.physics_type == 'KEYED':
+ col = row.column()
+ #doesn't work yet
+ #col.alert = key.valid
+ col.prop(key, "object", text="")
+ col.prop(key, "system", text="System")
+ col = row.column()
+ col.active = psys.use_keyed_timing
+ col.prop(key, "time")
+ col.prop(key, "duration")
+ elif part.physics_type == 'BOIDS':
+ sub = row.row()
+ #doesn't work yet
+ #sub.alert = key.valid
+ sub.prop(key, "object", text="")
+ sub.prop(key, "system", text="System")
+
+ layout.prop(key, "alliance", expand=True)
+ elif part.physics_type == 'FLUID':
+ sub = row.row()
+ #doesn't work yet
+ #sub.alert = key.valid
+ sub.prop(key, "object", text="")
+ sub.prop(key, "system", text="System")
+
+
+class PARTICLE_PT_boidbrain(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Boid Brain"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ settings = particle_get_settings(context)
+ engine = context.scene.render.engine
+
+ if settings is None:
+ return False
+ if psys != None and psys.point_cache.use_external:
+ return False
+ return settings.physics_type == 'BOIDS' and engine in cls.COMPAT_ENGINES
+
+ def draw(self, context):
+ layout = self.layout
+
+ boids = particle_get_settings(context).boids
+
+ layout.enabled = particle_panel_enabled(context, context.particle_system)
+
+ # Currently boids can only use the first state so these are commented out for now.
+ #row = layout.row()
+ #row.template_list(boids, "states", boids, "active_boid_state_index", compact="True")
+ #col = row.row()
+ #sub = col.row(align=True)
+ #sub.operator("boid.state_add", icon='ZOOMIN', text="")
+ #sub.operator("boid.state_del", icon='ZOOMOUT', text="")
+ #sub = row.row(align=True)
+ #sub.operator("boid.state_move_up", icon='MOVE_UP_VEC', text="")
+ #sub.operator("boid.state_move_down", icon='MOVE_DOWN_VEC', text="")
+
+ state = boids.active_boid_state
+
+ #layout.prop(state, "name", text="State name")
+
+ row = layout.row()
+ row.prop(state, "ruleset_type")
+ if state.ruleset_type == 'FUZZY':
+ row.prop(state, "rule_fuzzy", slider=True)
+ else:
+ row.label(text="")
+
+ row = layout.row()
+ row.template_list(state, "rules", state, "active_boid_rule_index")
+
+ col = row.column()
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator_menu_enum("boid.rule_add", "type", icon='ZOOMIN', text="")
+ subsub.operator("boid.rule_del", icon='ZOOMOUT', text="")
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("boid.rule_move_up", icon='MOVE_UP_VEC', text="")
+ subsub.operator("boid.rule_move_down", icon='MOVE_DOWN_VEC', text="")
+
+ rule = state.active_boid_rule
+
+ if rule:
+ row = layout.row()
+ row.prop(rule, "name", text="")
+ #somebody make nice icons for boids here please! -jahka
+ row.prop(rule, "use_in_air", icon='MOVE_UP_VEC', text="")
+ row.prop(rule, "use_on_land", icon='MOVE_DOWN_VEC', text="")
+
+ row = layout.row()
+
+ if rule.type == 'GOAL':
+ row.prop(rule, "object")
+ row = layout.row()
+ row.prop(rule, "use_predict")
+ elif rule.type == 'AVOID':
+ row.prop(rule, "object")
+ row = layout.row()
+ row.prop(rule, "use_predict")
+ row.prop(rule, "fear_factor")
+ elif rule.type == 'FOLLOW_PATH':
+ row.label(text="Not yet functional.")
+ elif rule.type == 'AVOID_COLLISION':
+ row.prop(rule, "use_avoid")
+ row.prop(rule, "use_avoid_collision")
+ row.prop(rule, "look_ahead")
+ elif rule.type == 'FOLLOW_LEADER':
+ row.prop(rule, "object", text="")
+ row.prop(rule, "distance")
+ row = layout.row()
+ row.prop(rule, "use_line")
+ sub = row.row()
+ sub.active = rule.line
+ sub.prop(rule, "queue_count")
+ elif rule.type == 'AVERAGE_SPEED':
+ row.prop(rule, "speed", slider=True)
+ row.prop(rule, "wander", slider=True)
+ row.prop(rule, "level", slider=True)
+ elif rule.type == 'FIGHT':
+ row.prop(rule, "distance")
+ row.prop(rule, "flee_distance")
+
+
+class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Render"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ engine = context.scene.render.engine
+ if psys is None:
+ return False
+ if psys.settings is None:
+ return False
+ return engine in cls.COMPAT_ENGINES
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = psys.settings
+
+ row = layout.row()
+ row.prop(part, "material")
+ row.prop(psys, "parent")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(part, "use_render_emitter")
+ col.prop(part, "use_parent_particles")
+
+ col = split.column()
+ col.prop(part, "show_unborn")
+ col.prop(part, "use_dead")
+
+ layout.prop(part, "render_type", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+
+ if part.render_type == 'LINE':
+ col.prop(part, "line_length_tail")
+ col.prop(part, "line_length_head")
+
+ split.prop(part, "use_velocity_length")
+ elif part.render_type == 'PATH':
+ col.prop(part, "use_strand_primitive")
+ sub = col.column()
+ sub.active = (part.use_strand_primitive is False)
+ sub.prop(part, "use_render_adaptive")
+ sub = col.column()
+ sub.active = part.use_render_adaptive or part.use_strand_primitive == True
+ sub.prop(part, "adaptive_angle")
+ sub = col.column()
+ sub.active = (part.use_render_adaptive is True and part.use_strand_primitive is False)
+ sub.prop(part, "adaptive_pixel")
+ col.prop(part, "use_hair_bspline")
+ col.prop(part, "render_step", text="Steps")
+
+ col = split.column()
+ col.label(text="Timing:")
+ col.prop(part, "use_absolute_path_time")
+ col.prop(part, "path_start", text="Start", slider=not part.use_absolute_path_time)
+ col.prop(part, "path_end", text="End", slider=not part.use_absolute_path_time)
+ col.prop(part, "length_random", text="Random", slider=True)
+
+ row = layout.row()
+ col = row.column()
+
+ if part.type == 'HAIR' and part.use_strand_primitive == True and part.child_type == 'INTERPOLATED':
+ layout.prop(part, "use_simplify")
+ if part.use_simplify == True:
+ row = layout.row()
+ row.prop(part, "simplify_refsize")
+ row.prop(part, "simplify_rate")
+ row.prop(part, "simplify_transition")
+ row = layout.row()
+ row.prop(part, "use_simplify_viewport")
+ sub = row.row()
+ sub.active = part.viewport == True
+ sub.prop(part, "simplify_viewport")
+
+ elif part.render_type == 'OBJECT':
+ col.prop(part, "dupli_object")
+ col.prop(part, "use_global_dupli")
+ elif part.render_type == 'GROUP':
+ col.prop(part, "dupli_group")
+ split = layout.split()
+
+ col = split.column()
+ col.prop(part, "use_whole_group")
+ sub = col.column()
+ sub.active = (part.use_whole_group is False)
+ sub.prop(part, "use_group_count")
+
+ col = split.column()
+ sub = col.column()
+ sub.active = (part.use_whole_group is False)
+ sub.prop(part, "use_global_dupli")
+ sub.prop(part, "use_group_pick_random")
+
+ if part.use_group_count and not part.use_whole_group:
+ row = layout.row()
+ row.template_list(part, "dupli_weights", part, "active_dupliweight_index")
+
+ col = row.column()
+ sub = col.row()
+ subsub = sub.column(align=True)
+ subsub.operator("particle.dupliob_copy", icon='ZOOMIN', text="")
+ subsub.operator("particle.dupliob_remove", icon='ZOOMOUT', text="")
+ subsub.operator("particle.dupliob_move_up", icon='MOVE_UP_VEC', text="")
+ subsub.operator("particle.dupliob_move_down", icon='MOVE_DOWN_VEC', text="")
+
+ weight = part.active_dupliweight
+ if weight:
+ row = layout.row()
+ row.prop(weight, "count")
+
+ elif part.render_type == 'BILLBOARD':
+ ob = context.object
+
+ col.label(text="Align:")
+
+ row = layout.row()
+ row.prop(part, "billboard_align", expand=True)
+ row.prop(part, "lock_billboard", text="Lock")
+ row = layout.row()
+ row.prop(part, "billboard_object")
+
+ row = layout.row()
+ col = row.column(align=True)
+ col.label(text="Tilt:")
+ col.prop(part, "billboard_tilt", text="Angle", slider=True)
+ col.prop(part, "billboard_tilt_random", text="Random", slider=True)
+ col = row.column()
+ col.prop(part, "billboard_offset")
+
+ col = layout.column()
+ col.prop_search(psys, "billboard_normal_uv", ob.data, "uv_textures")
+ col.prop_search(psys, "billboard_time_index_uv", ob.data, "uv_textures")
+
+ split = layout.split(percentage=0.33)
+ split.label(text="Split uv's:")
+ split.prop(part, "billboard_uv_split", text="Number of splits")
+ col = layout.column()
+ col.active = part.billboard_uv_split > 1
+ col.prop_search(psys, "billboard_split_uv", ob.data, "uv_textures")
+
+ row = col.row()
+ row.label(text="Animate:")
+ row.prop(part, "billboard_animation", text="")
+ row.label(text="Offset:")
+ row.prop(part, "billboard_offset_split", text="")
+
+ if part.render_type == 'HALO' or part.render_type == 'LINE' or part.render_type == 'BILLBOARD':
+ row = layout.row()
+ col = row.column()
+ col.prop(part, "trail_count")
+ if part.trail_count > 1:
+ col.prop(part, "use_absolute_path_time", text="Length in frames")
+ col = row.column()
+ col.prop(part, "path_end", text="Length", slider=not part.use_absolute_path_time)
+ col.prop(part, "length_random", text="Random", slider=True)
+ else:
+ col = row.column()
+ col.label(text="")
+
+ if part.render_type in ('OBJECT', 'GROUP') and not part.use_advanced_hair:
+ row = layout.row(align=True)
+ row.prop(part, "particle_size")
+ row.prop(part, "size_random", slider=True)
+
+
+class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Display"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ psys = context.particle_system
+ engine = context.scene.render.engine
+ if psys is None:
+ return False
+ if psys.settings is None:
+ return False
+ return engine in cls.COMPAT_ENGINES
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = particle_get_settings(context)
+
+ row = layout.row()
+ row.prop(part, "draw_method", expand=True)
+
+ if part.draw_method == 'NONE' or (part.render_type == 'NONE' and part.draw_method == 'RENDER'):
+ return
+
+ path = (part.render_type == 'PATH' and part.draw_method == 'RENDER') or part.draw_method == 'PATH'
+
+ row = layout.row()
+ row.prop(part, "draw_percentage", slider=True)
+ if part.draw_method != 'RENDER' or part.render_type == 'HALO':
+ row.prop(part, "draw_size")
+ else:
+ row.label(text="")
+
+ if part.draw_percentage != 100:
+ if part.type == 'HAIR':
+ if psys.use_hair_dynamics and psys.point_cache.is_baked == False:
+ layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+ else:
+ phystype = part.physics_type
+ if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked == False:
+ layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+
+ row = layout.row()
+ col = row.column()
+ col.prop(part, "show_size")
+ col.prop(part, "show_velocity")
+ col.prop(part, "show_number")
+ if part.physics_type == 'BOIDS':
+ col.prop(part, "show_health")
+
+ col = row.column(align=True)
+ col.label(text="Color:")
+ col.prop(part, "draw_color", text="")
+ sub = col.row()
+ sub.active = part.draw_color in ('VELOCITY', 'ACCELERATION')
+ sub.prop(part, "color_maximum", text="Max")
+
+ if (path):
+ col.prop(part, "draw_step")
+
+
+class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Children"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
+
+ def draw(self, context):
+ layout = self.layout
+
+ psys = context.particle_system
+ part = particle_get_settings(context)
+
+ layout.row().prop(part, "child_type", expand=True)
+
+ if part.child_type == 'NONE':
+ return
+
+ row = layout.row()
+
+ col = row.column(align=True)
+ col.prop(part, "child_nbr", text="Display")
+ col.prop(part, "rendered_child_count", text="Render")
+
+ if part.child_type == 'INTERPOLATED':
+ col = row.column()
+ if psys:
+ col.prop(psys, "child_seed", text="Seed")
+ col.prop(part, "virtual_parents", slider=True)
+ col.prop(part, "create_long_hair_children")
+ else:
+ col = row.column(align=True)
+ col.prop(part, "child_size", text="Size")
+ col.prop(part, "child_size_random", text="Random")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Effects:")
+
+ sub = col.column(align=True)
+ sub.prop(part, "clump_factor", slider=True)
+ sub.prop(part, "clump_shape", slider=True)
+
+ sub = col.column(align=True)
+ sub.prop(part, "child_length", slider=True)
+ sub.prop(part, "child_length_threshold", slider=True)
+
+ if part.child_type == 'SIMPLE':
+ sub = col.column(align=True)
+ sub.prop(part, "child_radius", text="Radius")
+ sub.prop(part, "child_roundness", text="Roundness", slider=True)
+ if psys:
+ sub.prop(psys, "child_seed", text="Seed")
+ elif part.virtual_parents > 0.0:
+ sub = col.column(align=True)
+ sub.label(text="Parting not")
+ sub.label(text="available with")
+ sub.label(text="virtual parents.")
+ else:
+ sub = col.column(align=True)
+ sub.prop(part, "child_parting_factor", text="Parting", slider=True)
+ sub.prop(part, "child_parting_min", text="Min")
+ sub.prop(part, "child_parting_max", text="Max")
+
+ col = split.column()
+ col.label(text="Roughness:")
+
+ sub = col.column(align=True)
+ sub.prop(part, "roughness_1", text="Uniform")
+ sub.prop(part, "roughness_1_size", text="Size")
+
+ sub = col.column(align=True)
+ sub.prop(part, "roughness_endpoint", "Endpoint")
+ sub.prop(part, "roughness_end_shape")
+
+ sub = col.column(align=True)
+ sub.prop(part, "roughness_2", text="Random")
+ sub.prop(part, "roughness_2_size", text="Size")
+ sub.prop(part, "roughness_2_threshold", slider=True)
+
+ layout.row().label(text="Kink:")
+ layout.row().prop(part, "kink", expand=True)
+
+ split = layout.split()
+ split.active = part.kink != 'NO'
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.prop(part, "kink_amplitude")
+ sub.prop(part, "kink_amplitude_clump", text="Clump", slider=True)
+ col.prop(part, "kink_flat", slider=True)
+ col = split.column()
+ sub = col.column(align=True)
+ sub.prop(part, "kink_frequency")
+ sub.prop(part, "kink_shape", slider=True)
+
+
+class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Field Weights"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ return particle_panel_poll(cls, context)
+
+ def draw(self, context):
+ part = particle_get_settings(context)
+ effector_weights_ui(self, context, part.effector_weights)
+
+ if part.type == 'HAIR':
+ row = self.layout.row()
+ row.prop(part.effector_weights, "apply_to_hair_growing")
+ row.prop(part, "apply_effector_to_children")
+ row = self.layout.row()
+ row.prop(part, "effect_hair", slider=True)
+
+
+class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Force Field Settings"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ part = particle_get_settings(context)
+
+ row = layout.row()
+ row.prop(part, "use_self_effect")
+ row.prop(part, "effector_amount", text="Amount")
+
+ split = layout.split(percentage=0.2)
+ split.label(text="Type 1:")
+ split.prop(part.force_field_1, "type", text="")
+ basic_force_field_settings_ui(self, context, part.force_field_1)
+ if part.force_field_1.type != 'NONE':
+ layout.label(text="Falloff:")
+ basic_force_field_falloff_ui(self, context, part.force_field_1)
+
+ if part.force_field_1.type != 'NONE':
+ layout.label(text="")
+
+ split = layout.split(percentage=0.2)
+ split.label(text="Type 2:")
+ split.prop(part.force_field_2, "type", text="")
+ basic_force_field_settings_ui(self, context, part.force_field_2)
+ if part.force_field_2.type != 'NONE':
+ layout.label(text="Falloff:")
+ basic_force_field_falloff_ui(self, context, part.force_field_2)
+
+
+class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
+ bl_label = "Vertexgroups"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ if context.particle_system == None:
+ return False
+ return particle_panel_poll(cls, context)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ psys = context.particle_system
+
+ row = layout.row()
+ row.label(text="Vertex Group")
+ row.label(text="Negate")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_density", ob, "vertex_groups", text="Density")
+ row.prop(psys, "invert_vertex_group_density", text="")
+
+ # Commented out vertex groups don't work and are still waiting for better implementation
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_velocity", ob, "vertex_groups", text="Velocity")
+ # row.prop(psys, "invert_vertex_group_velocity", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_length", ob, "vertex_groups", text="Length")
+ row.prop(psys, "invert_vertex_group_length", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_clump", ob, "vertex_groups", text="Clump")
+ row.prop(psys, "invert_vertex_group_clump", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_kink", ob, "vertex_groups", text="Kink")
+ row.prop(psys, "invert_vertex_group_kink", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_roughness_1", ob, "vertex_groups", text="Roughness 1")
+ row.prop(psys, "invert_vertex_group_roughness_1", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_roughness_2", ob, "vertex_groups", text="Roughness 2")
+ row.prop(psys, "invert_vertex_group_roughness_2", text="")
+
+ row = layout.row()
+ row.prop_search(psys, "vertex_group_roughness_end", ob, "vertex_groups", text="Roughness End")
+ row.prop(psys, "invert_vertex_group_roughness_end", text="")
+
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_size", ob, "vertex_groups", text="Size")
+ # row.prop(psys, "invert_vertex_group_size", text="")
+
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_tangent", ob, "vertex_groups", text="Tangent")
+ # row.prop(psys, "invert_vertex_group_tangent", text="")
+
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_rotation", ob, "vertex_groups", text="Rotation")
+ # row.prop(psys, "invert_vertex_group_rotation", text="")
+
+ # row = layout.row()
+ # row.prop_search(psys, "vertex_group_field", ob, "vertex_groups", text="Field")
+ # row.prop(psys, "invert_vertex_group_field", text="")
+
+
+class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+ _context_path = "particle_system.settings"
+ _property_type = bpy.types.ParticleSettings
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
new file mode 100644
index 00000000000..9bc3075a021
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -0,0 +1,218 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+from bl_ui.properties_physics_common import (
+ point_cache_ui,
+ effector_weights_ui,
+ )
+
+
+def cloth_panel_enabled(md):
+ return md.point_cache.is_baked is False
+
+
+class CLOTH_MT_presets(bpy.types.Menu):
+ '''
+ Creates the menu items by scanning scripts/templates
+ '''
+ bl_label = "Cloth Presets"
+ preset_subdir = "cloth"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.cloth)
+
+
+class PHYSICS_PT_cloth(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Cloth"
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.cloth
+ ob = context.object
+
+ if md:
+ cloth = md.settings
+
+ split = layout.split()
+
+ split.active = cloth_panel_enabled(md)
+
+ col = split.column()
+
+ col.label(text="Presets:")
+ sub = col.row(align=True)
+ sub.menu("CLOTH_MT_presets", text=bpy.types.CLOTH_MT_presets.bl_label)
+ sub.operator("cloth.preset_add", text="", icon="ZOOMIN")
+ sub.operator("cloth.preset_add", text="", icon="ZOOMOUT").remove_active = True
+
+ col.label(text="Quality:")
+ col.prop(cloth, "quality", text="Steps", slider=True)
+
+ col.label(text="Material:")
+ col.prop(cloth, "mass")
+ col.prop(cloth, "structural_stiffness", text="Structural")
+ col.prop(cloth, "bending_stiffness", text="Bending")
+
+ col = split.column()
+
+ col.label(text="Damping:")
+ col.prop(cloth, "spring_damping", text="Spring")
+ col.prop(cloth, "air_damping", text="Air")
+
+ col.prop(cloth, "use_pin_cloth", text="Pinning")
+ sub = col.column()
+ sub.active = cloth.use_pin_cloth
+ sub.prop_search(cloth, "vertex_group_mass", ob, "vertex_groups", text="")
+ sub.prop(cloth, "pin_stiffness", text="Stiffness")
+
+ col.label(text="Pre roll:")
+ col.prop(cloth, "pre_roll", text="Frame")
+
+ # Disabled for now
+ """
+ if cloth.vertex_group_mass:
+ layout.label(text="Goal:")
+
+ col = layout.column_flow()
+ col.prop(cloth, "goal_default", text="Default")
+ col.prop(cloth, "goal_spring", text="Stiffness")
+ col.prop(cloth, "goal_friction", text="Friction")
+ """
+
+ key = ob.data.shape_keys
+
+ if key:
+ col.label(text="Rest Shape Key:")
+ col.prop_search(cloth, "rest_shape_key", key, "keys", text="")
+
+
+class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Cloth Cache"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.cloth
+
+ def draw(self, context):
+ md = context.cloth
+ point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH')
+
+
+class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Cloth Collision"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.cloth
+
+ def draw_header(self, context):
+ cloth = context.cloth.collision_settings
+
+ self.layout.active = cloth_panel_enabled(context.cloth)
+ self.layout.prop(cloth, "use_collision", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ cloth = context.cloth.collision_settings
+ md = context.cloth
+
+ layout.active = cloth.use_collision and cloth_panel_enabled(md)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(cloth, "collision_quality", slider=True, text="Quality")
+ col.prop(cloth, "distance_min", slider=True, text="Distance")
+ col.prop(cloth, "friction")
+
+ col = split.column()
+ col.prop(cloth, "use_self_collision", text="Self Collision")
+ sub = col.column()
+ sub.active = cloth.use_self_collision
+ sub.prop(cloth, "self_collision_quality", slider=True, text="Quality")
+ sub.prop(cloth, "self_distance_min", slider=True, text="Distance")
+
+ layout.prop(cloth, "group")
+
+
+class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Cloth Stiffness Scaling"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.cloth
+
+ def draw_header(self, context):
+ cloth = context.cloth.settings
+
+ self.layout.active = cloth_panel_enabled(context.cloth)
+ self.layout.prop(cloth, "use_stiffness_scale", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.cloth
+ ob = context.object
+ cloth = context.cloth.settings
+
+ layout.active = cloth.use_stiffness_scale and cloth_panel_enabled(md)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Structural Stiffness:")
+ col.prop_search(cloth, "vertex_group_structural_stiffness", ob, "vertex_groups", text="")
+ col.prop(cloth, "structural_stiffness_max", text="Max")
+
+ col = split.column()
+ col.label(text="Bending Stiffness:")
+ col.prop_search(cloth, "vertex_group_bending", ob, "vertex_groups", text="")
+ col.prop(cloth, "bending_stiffness_max", text="Max")
+
+
+class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Cloth Field Weights"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.cloth)
+
+ def draw(self, context):
+ cloth = context.cloth.settings
+ effector_weights_ui(self, context, cloth.effector_weights)
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
new file mode 100644
index 00000000000..fea012cc7c6
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -0,0 +1,282 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.object) and (not rd.use_game_engine)
+
+
+def physics_add(self, layout, md, name, type, typeicon, toggles):
+ sub = layout.row(align=True)
+ if md:
+ sub.context_pointer_set("modifier", md)
+ sub.operator("object.modifier_remove", text=name, icon='X')
+ if(toggles):
+ sub.prop(md, "show_render", text="")
+ sub.prop(md, "show_viewport", text="")
+ else:
+ sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
+
+
+class PHYSICS_PT_add(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ ob = context.object
+
+ layout = self.layout
+ layout.label("Enable physics for:")
+ split = layout.split()
+ col = split.column()
+
+ if(context.object.field.type == 'NONE'):
+ col.operator("object.forcefield_toggle", text="Force Field", icon='FORCE_FORCE')
+ else:
+ col.operator("object.forcefield_toggle", text="Force Field", icon='X')
+
+ if(ob.type == 'MESH'):
+ physics_add(self, col, context.collision, "Collision", 'COLLISION', 'MOD_PHYSICS', False)
+ physics_add(self, col, context.cloth, "Cloth", 'CLOTH', 'MOD_CLOTH', True)
+
+ col = split.column()
+
+ if(ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE'):
+ physics_add(self, col, context.soft_body, "Soft Body", 'SOFT_BODY', 'MOD_SOFT', True)
+
+ if(ob.type == 'MESH'):
+ physics_add(self, col, context.fluid, "Fluid", 'FLUID_SIMULATION', 'MOD_FLUIDSIM', True)
+ physics_add(self, col, context.smoke, "Smoke", 'SMOKE', 'MOD_SMOKE', True)
+
+
+#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
+
+def point_cache_ui(self, context, cache, enabled, cachetype):
+ layout = self.layout
+
+ layout.context_pointer_set("point_cache", cache)
+
+ row = layout.row()
+ row.template_list(cache, "point_caches", cache.point_caches, "active_index", rows=2)
+ col = row.column(align=True)
+ col.operator("ptcache.add", icon='ZOOMIN', text="")
+ col.operator("ptcache.remove", icon='ZOOMOUT', text="")
+
+ row = layout.row()
+ if cachetype in {'PSYS', 'HAIR', 'SMOKE'}:
+ row.prop(cache, "use_external")
+
+ if cache.use_external:
+ split = layout.split(percentage=0.80)
+ split.prop(cache, "name", text="File Name")
+ split.prop(cache, "index", text="")
+
+ row = layout.row()
+ row.label(text="File Path:")
+ row.prop(cache, "use_library_path", "Use Lib Path")
+
+ layout.prop(cache, "filepath", text="")
+
+ layout.label(text=cache.info)
+ else:
+ if cachetype == 'SMOKE':
+ if bpy.data.is_dirty:
+ layout.label(text="Cache is disabled until the file is saved")
+ layout.enabled = False
+
+ if cache.use_disk_cache:
+ layout.prop(cache, "name", text="File Name")
+ else:
+ layout.prop(cache, "name", text="Cache Name")
+
+ row = layout.row(align=True)
+
+ if cachetype != 'PSYS':
+ row.enabled = enabled
+ row.prop(cache, "frame_start")
+ row.prop(cache, "frame_end")
+ if cachetype not in {'SMOKE', 'CLOTH'}:
+ row.prop(cache, "frame_step")
+ row.prop(cache, "use_quick_cache")
+ if cachetype != 'SMOKE':
+ layout.label(text=cache.info)
+
+ if cachetype != 'SMOKE':
+ split = layout.split()
+ split.enabled = enabled and (not bpy.data.is_dirty)
+
+ col = split.column()
+ col.prop(cache, "use_disk_cache")
+
+ col = split.column()
+ col.active = cache.use_disk_cache
+ col.prop(cache, "use_library_path", "Use Lib Path")
+
+ row = layout.row()
+ row.enabled = enabled and (not bpy.data.is_dirty)
+ row.active = cache.use_disk_cache
+ row.label(text="Compression:")
+ row.prop(cache, "compression", expand=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+
+ if cache.is_baked == True:
+ col.operator("ptcache.free_bake", text="Free Bake")
+ else:
+ col.operator("ptcache.bake", text="Bake").bake = True
+
+ sub = col.row()
+ sub.enabled = (cache.frames_skipped or cache.is_outdated) and enabled
+ sub.operator("ptcache.bake", text="Calculate To Frame").bake = False
+
+ sub = col.column()
+ sub.enabled = enabled
+ sub.operator("ptcache.bake_from_cache", text="Current Cache to Bake")
+
+ col = split.column()
+ col.operator("ptcache.bake_all", text="Bake All Dynamics").bake = True
+ col.operator("ptcache.free_bake_all", text="Free All Bakes")
+ col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
+
+
+def effector_weights_ui(self, context, weights):
+ layout = self.layout
+
+ layout.prop(weights, "group")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(weights, "gravity", slider=True)
+
+ col = split.column()
+ col.prop(weights, "all", slider=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(weights, "force", slider=True)
+ col.prop(weights, "vortex", slider=True)
+ col.prop(weights, "magnetic", slider=True)
+ col.prop(weights, "wind", slider=True)
+ col.prop(weights, "curve_guide", slider=True)
+ col.prop(weights, "texture", slider=True)
+
+ col = split.column()
+ col.prop(weights, "harmonic", slider=True)
+ col.prop(weights, "charge", slider=True)
+ col.prop(weights, "lennardjones", slider=True)
+ col.prop(weights, "turbulence", slider=True)
+ col.prop(weights, "drag", slider=True)
+ col.prop(weights, "boid", slider=True)
+
+
+def basic_force_field_settings_ui(self, context, field):
+ layout = self.layout
+
+ split = layout.split()
+
+ if not field or field.type == 'NONE':
+ return
+
+ col = split.column()
+
+ if field.type == 'DRAG':
+ col.prop(field, "linear_drag", text="Linear")
+ else:
+ col.prop(field, "strength")
+
+ if field.type == 'TURBULENCE':
+ col.prop(field, "size")
+ col.prop(field, "flow")
+ elif field.type == 'HARMONIC':
+ col.prop(field, "harmonic_damping", text="Damping")
+ col.prop(field, "rest_length")
+ elif field.type == 'VORTEX' and field.shape != 'POINT':
+ col.prop(field, "inflow")
+ elif field.type == 'DRAG':
+ col.prop(field, "quadratic_drag", text="Quadratic")
+ else:
+ col.prop(field, "flow")
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.prop(field, "noise")
+ sub.prop(field, "seed")
+ if field.type == 'TURBULENCE':
+ col.prop(field, "use_global_coords", text="Global")
+ elif field.type == 'HARMONIC':
+ col.prop(field, "use_multiple_springs")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Effect point:")
+ col.prop(field, "apply_to_location")
+ col.prop(field, "apply_to_rotation")
+
+ col = split.column()
+ col.label(text="Collision:")
+ col.prop(field, "use_absorption")
+
+
+def basic_force_field_falloff_ui(self, context, field):
+ layout = self.layout
+
+ split = layout.split(percentage=0.35)
+
+ if not field or field.type == 'NONE':
+ return
+
+ col = split.column()
+ col.prop(field, "z_direction", text="")
+
+ col = split.column()
+ col.prop(field, "falloff_power", text="Power")
+
+ split = layout.split()
+ col = split.column()
+ row = col.row(align=True)
+ row.prop(field, "use_min_distance", text="")
+ sub = row.row()
+ sub.active = field.use_min_distance
+ sub.prop(field, "distance_min", text="Minimum")
+
+ col = split.column()
+ row = col.row(align=True)
+ row.prop(field, "use_max_distance", text="")
+ sub = row.row()
+ sub.active = field.use_max_distance
+ sub.prop(field, "distance_max", text="Maximum")
diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py
new file mode 100644
index 00000000000..fd5549c6e0a
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_field.py
@@ -0,0 +1,218 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+from bl_ui.properties_physics_common import (
+ basic_force_field_settings_ui,
+ basic_force_field_falloff_ui,
+ )
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.object) and (not rd.use_game_engine)
+
+
+class PHYSICS_PT_field(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Force Fields"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (not rd.use_game_engine) and (ob.field) and (ob.field.type != 'NONE')
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.object
+ field = ob.field
+
+ split = layout.split(percentage=0.2)
+ split.label(text="Type:")
+
+ split.prop(field, "type", text="")
+
+ if field.type not in {'NONE', 'GUIDE', 'TEXTURE'}:
+ split = layout.split(percentage=0.2)
+ split.label(text="Shape:")
+ split.prop(field, "shape", text="")
+
+ split = layout.split()
+
+ if field.type == 'NONE':
+ return # nothing to draw
+ elif field.type == 'GUIDE':
+ col = split.column()
+ col.prop(field, "guide_minimum")
+ col.prop(field, "guide_free")
+ col.prop(field, "falloff_power")
+ col.prop(field, "use_guide_path_add")
+ col.prop(field, "use_guide_path_weight")
+
+ col = split.column()
+ col.label(text="Clumping:")
+ col.prop(field, "guide_clump_amount")
+ col.prop(field, "guide_clump_shape")
+
+ row = layout.row()
+ row.prop(field, "use_max_distance")
+ sub = row.row()
+ sub.active = field.use_max_distance
+ sub.prop(field, "distance_max")
+
+ layout.separator()
+
+ layout.prop(field, "guide_kink_type")
+ if (field.guide_kink_type != 'NONE'):
+ layout.prop(field, "guide_kink_axis")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(field, "guide_kink_frequency")
+ col.prop(field, "guide_kink_shape")
+
+ col = split.column()
+ col.prop(field, "guide_kink_amplitude")
+
+ elif field.type == 'TEXTURE':
+ col = split.column()
+ col.prop(field, "strength")
+ col.prop(field, "texture", text="")
+ col.prop(field, "texture_mode", text="")
+ col.prop(field, "texture_nabla")
+
+ col = split.column()
+ col.prop(field, "use_object_coords")
+ col.prop(field, "use_root_coords")
+ col.prop(field, "use_2d_force")
+ else:
+ basic_force_field_settings_ui(self, context, field)
+
+ if field.type not in {'NONE', 'GUIDE'}:
+
+ layout.label(text="Falloff:")
+ layout.prop(field, "falloff_type", expand=True)
+
+ basic_force_field_falloff_ui(self, context, field)
+
+ if field.falloff_type == 'CONE':
+ layout.separator()
+
+ split = layout.split(percentage=0.35)
+
+ col = split.column()
+ col.label(text="Angular:")
+ col.prop(field, "use_radial_min", text="Use Minimum")
+ col.prop(field, "use_radial_max", text="Use Maximum")
+
+ col = split.column()
+ col.prop(field, "radial_falloff", text="Power")
+
+ sub = col.column()
+ sub.active = field.use_radial_min
+ sub.prop(field, "radial_min", text="Angle")
+
+ sub = col.column()
+ sub.active = field.use_radial_max
+ sub.prop(field, "radial_max", text="Angle")
+
+ elif field.falloff_type == 'TUBE':
+ layout.separator()
+
+ split = layout.split(percentage=0.35)
+
+ col = split.column()
+ col.label(text="Radial:")
+ col.prop(field, "use_radial_min", text="Use Minimum")
+ col.prop(field, "use_radial_max", text="Use Maximum")
+
+ col = split.column()
+ col.prop(field, "radial_falloff", text="Power")
+
+ sub = col.column()
+ sub.active = field.use_radial_min
+ sub.prop(field, "radial_min", text="Distance")
+
+ sub = col.column()
+ sub.active = field.use_radial_max
+ sub.prop(field, "radial_max", text="Distance")
+
+
+class PHYSICS_PT_collision(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Collision"
+ #bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.collision)
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.collision
+
+ split = layout.split()
+
+ coll = md.settings
+
+ if coll:
+ settings = context.object.collision
+
+ layout.active = settings.use
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Particle:")
+ col.prop(settings, "permeability", slider=True)
+ col.prop(settings, "stickness")
+ col.prop(settings, "use_particle_kill")
+ col.label(text="Particle Damping:")
+ sub = col.column(align=True)
+ sub.prop(settings, "damping_factor", text="Factor", slider=True)
+ sub.prop(settings, "damping_random", text="Random", slider=True)
+
+ col.label(text="Particle Friction:")
+ sub = col.column(align=True)
+ sub.prop(settings, "friction_factor", text="Factor", slider=True)
+ sub.prop(settings, "friction_random", text="Random", slider=True)
+
+ col = split.column()
+ col.label(text="Soft Body and Cloth:")
+ sub = col.column(align=True)
+ sub.prop(settings, "thickness_outer", text="Outer", slider=True)
+ sub.prop(settings, "thickness_inner", text="Inner", slider=True)
+
+ col.label(text="Soft Body Damping:")
+ col.prop(settings, "damping", text="Factor", slider=True)
+
+ col.label(text="Force Fields:")
+ col.prop(settings, "absorption", text="Absorption")
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
new file mode 100644
index 00000000000..53eb67e1340
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -0,0 +1,281 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.fluid)
+
+
+class PHYSICS_PT_fluid(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Fluid"
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.fluid
+
+ if md:
+ fluid = md.settings
+
+ row = layout.row()
+ if fluid is None:
+ row.label("built without fluids")
+ return
+
+ row.prop(fluid, "type")
+ if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
+ row.prop(fluid, "use", text="")
+
+ layout = layout.column()
+ if fluid.type not in {'NONE', 'DOMAIN', 'PARTICLE', 'FLUID'}:
+ layout.active = fluid.use
+
+ if fluid.type == 'DOMAIN':
+ layout.operator("fluid.bake", text="Bake (Req. Memory: %s)" % fluid.memory_estimate, icon='MOD_FLUIDSIM')
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Resolution:")
+ col.prop(fluid, "resolution", text="Final")
+ col.label(text="Render Display:")
+ col.prop(fluid, "render_display_mode", text="")
+
+ col = split.column()
+ col.label()
+ col.prop(fluid, "preview_resolution", text="Preview")
+ col.label(text="Viewport Display:")
+ col.prop(fluid, "viewport_display_mode", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Time:")
+ sub = col.column(align=True)
+ sub.prop(fluid, "start_time", text="Start")
+ sub.prop(fluid, "end_time", text="End")
+
+ col = split.column()
+ col.label()
+ col.prop(fluid, "use_speed_vectors")
+ col.prop(fluid, "use_reverse_frames")
+
+ layout.prop(fluid, "filepath", text="")
+
+ elif fluid.type == 'FLUID':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Volume Initialization:")
+ col.prop(fluid, "volume_initialization", text="")
+ col.prop(fluid, "use_animated_mesh")
+
+ col = split.column()
+ col.label(text="Initial Velocity:")
+ col.prop(fluid, "initial_velocity", text="")
+
+ elif fluid.type == 'OBSTACLE':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Volume Initialization:")
+ col.prop(fluid, "volume_initialization", text="")
+ col.prop(fluid, "use_animated_mesh")
+
+ col = split.column()
+ col.label(text="Slip Type:")
+ col.prop(fluid, "slip_type", text="")
+ if fluid.slip_type == 'PARTIALSLIP':
+ col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
+
+ col.label(text="Impact:")
+ col.prop(fluid, "impact_factor", text="Factor")
+
+ elif fluid.type == 'INFLOW':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Volume Initialization:")
+ col.prop(fluid, "volume_initialization", text="")
+ col.prop(fluid, "use_animated_mesh")
+ col.prop(fluid, "use_local_coords")
+
+ col = split.column()
+ col.label(text="Inflow Velocity:")
+ col.prop(fluid, "inflow_velocity", text="")
+
+ elif fluid.type == 'OUTFLOW':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Volume Initialization:")
+ col.prop(fluid, "volume_initialization", text="")
+ col.prop(fluid, "use_animated_mesh")
+
+ split.column()
+
+ elif fluid.type == 'PARTICLE':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Influence:")
+ col.prop(fluid, "particle_influence", text="Size")
+ col.prop(fluid, "alpha_influence", text="Alpha")
+
+ col = split.column()
+ col.label(text="Type:")
+ col.prop(fluid, "use_drops")
+ col.prop(fluid, "use_floats")
+ col.prop(fluid, "show_tracer")
+
+ layout.prop(fluid, "filepath", text="")
+
+ elif fluid.type == 'CONTROL':
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="")
+ col.prop(fluid, "quality", slider=True)
+ col.prop(fluid, "use_reverse_frames")
+
+ col = split.column()
+ col.label(text="Time:")
+ sub = col.column(align=True)
+ sub.prop(fluid, "start_time", text="Start")
+ sub.prop(fluid, "end_time", text="End")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Attraction Force:")
+ sub = col.column(align=True)
+ sub.prop(fluid, "attraction_strength", text="Strength")
+ sub.prop(fluid, "attraction_radius", text="Radius")
+
+ col = split.column()
+ col.label(text="Velocity Force:")
+ sub = col.column(align=True)
+ sub.prop(fluid, "velocity_strength", text="Strength")
+ sub.prop(fluid, "velocity_radius", text="Radius")
+
+
+class PHYSICS_PT_domain_gravity(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Domain World"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.fluid
+ return md and md.settings and (md.settings.type == 'DOMAIN')
+
+ def draw(self, context):
+ layout = self.layout
+
+ fluid = context.fluid.settings
+ scene = context.scene
+
+ split = layout.split()
+
+ col = split.column()
+ if scene.use_gravity:
+ col.label(text="Using Scene Gravity", icon="SCENE_DATA")
+ sub = col.column()
+ sub.enabled = False
+ sub.prop(fluid, "gravity", text="")
+ else:
+ col.label(text="Gravity:")
+ col.prop(fluid, "gravity", text="")
+
+ if scene.unit_settings.system != 'NONE':
+ col.label(text="Using Scene Size Units", icon="SCENE_DATA")
+ sub = col.column()
+ sub.enabled = False
+ sub.prop(fluid, "simulation_scale", text="Metres")
+ else:
+ col.label(text="Real World Size:")
+ col.prop(fluid, "simulation_scale", text="Metres")
+
+ col = split.column()
+ col.label(text="Viscosity Presets:")
+ sub = col.column(align=True)
+ sub.prop(fluid, "viscosity_preset", text="")
+
+ if fluid.viscosity_preset == 'MANUAL':
+ sub.prop(fluid, "viscosity_base", text="Base")
+ sub.prop(fluid, "viscosity_exponent", text="Exponent", slider=True)
+
+ col.label(text="Optimization:")
+ col.prop(fluid, "grid_levels", slider=True)
+ col.prop(fluid, "compressibility", slider=True)
+
+
+class PHYSICS_PT_domain_boundary(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Domain Boundary"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.fluid
+ return md and md.settings and (md.settings.type == 'DOMAIN')
+
+ def draw(self, context):
+ layout = self.layout
+
+ fluid = context.fluid.settings
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Slip Type:")
+ col.prop(fluid, "slip_type", text="")
+ if fluid.slip_type == 'PARTIALSLIP':
+ col.prop(fluid, "partial_slip_factor", slider=True, text="Amount")
+
+ col = split.column()
+ col.label(text="Surface:")
+ col.prop(fluid, "surface_smooth", text="Smoothing")
+ col.prop(fluid, "surface_subdivisions", text="Subdivisions")
+
+
+class PHYSICS_PT_domain_particles(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Domain Particles"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.fluid
+ return md and md.settings and (md.settings.type == 'DOMAIN')
+
+ def draw(self, context):
+ layout = self.layout
+
+ fluid = context.fluid.settings
+
+ col = layout.column(align=True)
+ col.prop(fluid, "tracer_particles")
+ col.prop(fluid, "generate_particles")
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
new file mode 100644
index 00000000000..6cd1ceb5884
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -0,0 +1,203 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+from bl_ui.properties_physics_common import (
+ point_cache_ui,
+ effector_weights_ui,
+ )
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+ return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and (context.smoke)
+
+
+class PHYSICS_PT_smoke(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Smoke"
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.smoke
+ ob = context.object
+
+ if md:
+ layout.prop(md, "smoke_type", expand=True)
+
+ if md.smoke_type == 'DOMAIN':
+ domain = md.domain_settings
+
+ split = layout.split()
+
+ split.enabled = not domain.point_cache.is_baked
+
+ col = split.column()
+ col.label(text="Resolution:")
+ col.prop(domain, "resolution_max", text="Divisions")
+ col.label(text="Time:")
+ col.prop(domain, "time_scale", text="Scale")
+ col.label(text="Border Collisions:")
+ col.prop(domain, "collision_extents", text="")
+
+ col = split.column()
+ col.label(text="Behavior:")
+ col.prop(domain, "alpha")
+ col.prop(domain, "beta", text="Temp. Diff.")
+ col.prop(domain, "vorticity")
+ col.prop(domain, "use_dissolve_smoke", text="Dissolve")
+ sub = col.column()
+ sub.active = domain.use_dissolve_smoke
+ sub.prop(domain, "dissolve_speed", text="Time")
+ sub.prop(domain, "use_dissolve_smoke_log", text="Slow")
+
+ elif md.smoke_type == 'FLOW':
+
+ flow = md.flow_settings
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(flow, "use_outflow")
+ col.label(text="Particle System:")
+ col.prop_search(flow, "particle_system", ob, "particle_systems", text="")
+
+ sub = col.column()
+ sub.active = not md.flow_settings.use_outflow
+
+ sub.prop(flow, "initial_velocity", text="Initial Velocity")
+ sub = sub.column()
+ sub.active = flow.initial_velocity
+ sub.prop(flow, "velocity_factor", text="Multiplier")
+
+ sub = split.column()
+ sub.active = not md.flow_settings.use_outflow
+ sub.label(text="Initial Values:")
+ sub.prop(flow, "use_absolute")
+ sub.prop(flow, "density")
+ sub.prop(flow, "temperature")
+
+
+class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Smoke Groups"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.smoke
+ return md and (md.smoke_type == 'DOMAIN')
+
+ def draw(self, context):
+ layout = self.layout
+
+ group = context.smoke.domain_settings
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Flow Group:")
+ col.prop(group, "fluid_group", text="")
+
+ #col.label(text="Effector Group:")
+ #col.prop(group, "effector_group", text="")
+
+ col = split.column()
+ col.label(text="Collision Group:")
+ col.prop(group, "collision_group", text="")
+
+
+class PHYSICS_PT_smoke_highres(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Smoke High Resolution"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.smoke
+ return md and (md.smoke_type == 'DOMAIN')
+
+ def draw_header(self, context):
+ md = context.smoke.domain_settings
+
+ self.layout.prop(md, "use_high_resolution", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.smoke.domain_settings
+
+ layout.active = md.use_high_resolution
+
+ split = layout.split()
+ split.enabled = not md.point_cache.is_baked
+
+ col = split.column()
+ col.label(text="Resolution:")
+ col.prop(md, "amplify", text="Divisions")
+ col.prop(md, "smooth_emitter")
+
+ col = split.column()
+ col.label(text="Noise Method:")
+ col.row().prop(md, "noise_type", text="")
+ col.prop(md, "strength")
+
+ layout.prop(md, "show_high_resolution")
+
+
+class PHYSICS_PT_smoke_cache(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Smoke Cache"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ md = context.smoke
+ return md and (md.smoke_type == 'DOMAIN')
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.smoke.domain_settings
+ cache = md.point_cache
+
+ layout.label(text="Compression:")
+ layout.prop(md, "point_cache_compress_type", expand=True)
+
+ point_cache_ui(self, context, cache, (cache.is_baked is False), 'SMOKE')
+
+
+class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Smoke Field Weights"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ smoke = context.smoke
+ return (smoke and smoke.smoke_type == 'DOMAIN')
+
+ def draw(self, context):
+ domain = context.smoke.domain_settings
+ effector_weights_ui(self, context, domain.effector_weights)
diff --git a/release/scripts/startup/bl_ui/properties_physics_softbody.py b/release/scripts/startup/bl_ui/properties_physics_softbody.py
new file mode 100644
index 00000000000..2bd1a8599c1
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_physics_softbody.py
@@ -0,0 +1,263 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+from bl_ui.properties_physics_common import (
+ point_cache_ui,
+ effector_weights_ui,
+ )
+
+
+def softbody_panel_enabled(md):
+ return (md.point_cache.is_baked is False)
+
+
+class PhysicButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "physics"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.object
+ rd = context.scene.render
+# return (ob and ob.type == 'MESH') and (not rd.use_game_engine)
+# i really hate touching things i do not understand completely .. but i think this should read (bjornmose)
+ return (ob and (ob.type == 'MESH' or ob.type == 'LATTICE'or ob.type == 'CURVE')) and (not rd.use_game_engine) and (context.soft_body)
+
+
+class PHYSICS_PT_softbody(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body"
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.soft_body
+ ob = context.object
+
+ if md:
+ softbody = md.settings
+
+ # General
+ split = layout.split()
+ split.enabled = softbody_panel_enabled(md)
+
+ col = split.column()
+ col.label(text="Object:")
+ col.prop(softbody, "friction")
+ col.prop(softbody, "mass")
+ col.prop_search(softbody, "vertex_group_mass", ob, "vertex_groups", text="Mass:")
+
+ col = split.column()
+ col.label(text="Simulation:")
+ col.prop(softbody, "speed")
+
+
+class PHYSICS_PT_softbody_cache(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Cache"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.soft_body
+
+ def draw(self, context):
+ md = context.soft_body
+ point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY')
+
+
+class PHYSICS_PT_softbody_goal(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Goal"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.soft_body
+
+ def draw_header(self, context):
+ softbody = context.soft_body.settings
+
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.prop(softbody, "use_goal", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.soft_body
+ softbody = md.settings
+ ob = context.object
+
+ layout.active = softbody.use_goal and softbody_panel_enabled(md)
+
+ split = layout.split()
+
+ # Goal
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Goal Strengths:")
+ col.prop(softbody, "goal_default", text="Default")
+ sub = col.column(align=True)
+ sub.prop(softbody, "goal_min", text="Minimum")
+ sub.prop(softbody, "goal_max", text="Maximum")
+
+ col = split.column()
+ col.label(text="Goal Settings:")
+ col.prop(softbody, "goal_spring", text="Stiffness")
+ col.prop(softbody, "goal_friction", text="Damping")
+
+ layout.prop_search(softbody, "vertex_group_goal", ob, "vertex_groups", text="Vertex Group")
+
+
+class PHYSICS_PT_softbody_edge(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Edges"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.soft_body
+
+ def draw_header(self, context):
+ softbody = context.soft_body.settings
+
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.prop(softbody, "use_edges", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.soft_body
+ softbody = md.settings
+ ob = context.object
+
+ layout.active = softbody.use_edges and softbody_panel_enabled(md)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Springs:")
+ col.prop(softbody, "pull")
+ col.prop(softbody, "push")
+ col.prop(softbody, "damping")
+ col.prop(softbody, "plastic")
+ col.prop(softbody, "bend")
+ col.prop(softbody, "spring_length", text="Length")
+ col.prop_search(softbody, "vertex_group_spring", ob, "vertex_groups", text="Springs:")
+
+ col = split.column()
+ col.prop(softbody, "use_stiff_quads")
+ sub = col.column()
+ sub.active = softbody.use_stiff_quads
+ sub.prop(softbody, "shear")
+
+ col.label(text="Aerodynamics:")
+ col.row().prop(softbody, "aerodynamics_type", expand=True)
+ col.prop(softbody, "aero", text="Factor")
+
+ #sub = col.column()
+ #sub.enabled = softbody.aero > 0
+
+ col.label(text="Collision:")
+ col.prop(softbody, "use_edge_collision", text="Edge")
+ col.prop(softbody, "use_face_collision", text="Face")
+
+
+class PHYSICS_PT_softbody_collision(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Self Collision"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.soft_body
+
+ def draw_header(self, context):
+ softbody = context.soft_body.settings
+
+ self.layout.active = softbody_panel_enabled(context.soft_body)
+ self.layout.prop(softbody, "use_self_collision", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.soft_body
+ softbody = md.settings
+
+ layout.active = softbody.use_self_collision and softbody_panel_enabled(md)
+
+ layout.label(text="Collision Ball Size Calculation:")
+ layout.prop(softbody, "collision_type", expand=True)
+
+ col = layout.column(align=True)
+ col.label(text="Ball:")
+ col.prop(softbody, "ball_size", text="Size")
+ col.prop(softbody, "ball_stiff", text="Stiffness")
+ col.prop(softbody, "ball_damp", text="Dampening")
+
+
+class PHYSICS_PT_softbody_solver(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Solver"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return context.soft_body
+
+ def draw(self, context):
+ layout = self.layout
+
+ md = context.soft_body
+ softbody = md.settings
+
+ layout.active = softbody_panel_enabled(md)
+
+ # Solver
+ split = layout.split()
+
+ col = split.column(align=True)
+ col.label(text="Step Size:")
+ col.prop(softbody, "step_min")
+ col.prop(softbody, "step_max")
+ col.prop(softbody, "use_auto_step", text="Auto-Step")
+
+ col = split.column()
+ col.prop(softbody, "error_threshold")
+ col.label(text="Helpers:")
+ col.prop(softbody, "choke")
+ col.prop(softbody, "fuzzy")
+
+ layout.label(text="Diagnostics:")
+ layout.prop(softbody, "use_diagnose")
+ layout.prop(softbody, "use_estimate_matrix")
+
+
+class PHYSICS_PT_softbody_field_weights(PhysicButtonsPanel, bpy.types.Panel):
+ bl_label = "Soft Body Field Weights"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.soft_body)
+
+ def draw(self, context):
+ md = context.soft_body
+ softbody = md.settings
+
+ effector_weights_ui(self, context, softbody.effector_weights)
diff --git a/release/scripts/startup/bl_ui/properties_render.py b/release/scripts/startup/bl_ui/properties_render.py
new file mode 100644
index 00000000000..e4be38c560b
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_render.py
@@ -0,0 +1,638 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class RENDER_MT_presets(bpy.types.Menu):
+ bl_label = "Render Presets"
+ preset_subdir = "render"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class RENDER_MT_ffmpeg_presets(bpy.types.Menu):
+ bl_label = "FFMPEG Presets"
+ preset_subdir = "ffmpeg"
+ preset_operator = "script.python_file_run"
+ draw = bpy.types.Menu.draw_preset
+
+
+class RENDER_MT_framerate_presets(bpy.types.Menu):
+ bl_label = "Frame Rate Presets"
+ preset_subdir = "framerate"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class RenderButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "render"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.scene and rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
+
+
+class RENDER_PT_render(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Render"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ row = layout.row()
+ row.operator("render.render", text="Image", icon='RENDER_STILL')
+ row.operator("render.render", text="Animation", icon='RENDER_ANIMATION').animation = True
+
+ layout.prop(rd, "display_mode", text="Display")
+
+
+class RENDER_PT_layers(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Layers"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ rd = scene.render
+
+ row = layout.row()
+ row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
+ col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
+
+ row = layout.row()
+ rl = rd.layers.active
+ if rl:
+ row.prop(rl, "name")
+ row.prop(rd, "use_single_layer", text="", icon_only=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(scene, "layers", text="Scene")
+ col.label(text="")
+ col.prop(rl, "light_override", text="Light")
+ col.prop(rl, "material_override", text="Material")
+
+ col = split.column()
+ col.prop(rl, "layers", text="Layer")
+ col.label(text="Mask Layers:")
+ col.prop(rl, "layers_zmask", text="")
+
+ layout.separator()
+ layout.label(text="Include:")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rl, "use_zmask")
+ row = col.row()
+ row.prop(rl, "invert_zmask", text="Negate")
+ row.active = rl.use_zmask
+ col.prop(rl, "use_all_z")
+
+ col = split.column()
+ col.prop(rl, "use_solid")
+ col.prop(rl, "use_halo")
+ col.prop(rl, "use_ztransp")
+
+ col = split.column()
+ col.prop(rl, "use_sky")
+ col.prop(rl, "use_edge_enhance")
+ col.prop(rl, "use_strand")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Passes:")
+ col.prop(rl, "use_pass_combined")
+ col.prop(rl, "use_pass_z")
+ col.prop(rl, "use_pass_vector")
+ col.prop(rl, "use_pass_normal")
+ col.prop(rl, "use_pass_uv")
+ col.prop(rl, "use_pass_mist")
+ col.prop(rl, "use_pass_object_index")
+ col.prop(rl, "use_pass_color")
+
+ col = split.column()
+ col.label()
+ col.prop(rl, "use_pass_diffuse")
+ row = col.row()
+ row.prop(rl, "use_pass_specular")
+ row.prop(rl, "exclude_specular", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_shadow")
+ row.prop(rl, "exclude_shadow", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_emit")
+ row.prop(rl, "exclude_emit", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_ambient_occlusion")
+ row.prop(rl, "exclude_ambient_occlusion", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_environment")
+ row.prop(rl, "exclude_environment", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_indirect")
+ row.prop(rl, "exclude_indirect", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_reflection")
+ row.prop(rl, "exclude_reflection", text="")
+ row = col.row()
+ row.prop(rl, "use_pass_refraction")
+ row.prop(rl, "exclude_refraction", text="")
+
+
+class RENDER_PT_shading(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Shading"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "use_textures", text="Textures")
+ col.prop(rd, "use_shadows", text="Shadows")
+ col.prop(rd, "use_sss", text="Subsurface Scattering")
+ col.prop(rd, "use_envmaps", text="Environment Map")
+
+ col = split.column()
+ col.prop(rd, "use_raytrace", text="Ray Tracing")
+ col.prop(rd, "use_color_management")
+ col.prop(rd, "alpha_mode", text="Alpha")
+
+
+class RENDER_PT_performance(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Performance"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Threads:")
+ col.row().prop(rd, "threads_mode", expand=True)
+ sub = col.column()
+ sub.enabled = rd.threads_mode == 'FIXED'
+ sub.prop(rd, "threads")
+ sub = col.column(align=True)
+ sub.label(text="Tiles:")
+ sub.prop(rd, "parts_x", text="X")
+ sub.prop(rd, "parts_y", text="Y")
+
+ col = split.column()
+ col.label(text="Memory:")
+ sub = col.column()
+ sub.enabled = not (rd.use_border or rd.use_full_sample)
+ sub.prop(rd, "use_save_buffers")
+ sub = col.column()
+ sub.active = rd.use_compositing
+ sub.prop(rd, "use_free_image_textures")
+ sub.prop(rd, "use_free_unused_nodes")
+ sub = col.column()
+ sub.active = rd.use_raytrace
+ sub.label(text="Acceleration structure:")
+ sub.prop(rd, "raytrace_method", text="")
+ if rd.raytrace_method == 'OCTREE':
+ sub.prop(rd, "octree_resolution", text="Resolution")
+ else:
+ sub.prop(rd, "use_instances", text="Instances")
+ sub.prop(rd, "use_local_coords", text="Local Coordinates")
+
+
+class RENDER_PT_post_processing(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Post Processing"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "use_compositing")
+ col.prop(rd, "use_sequencer")
+
+ col = split.column()
+ col.prop(rd, "dither_intensity", text="Dither", slider=True)
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "use_fields", text="Fields")
+ sub = col.column()
+ sub.active = rd.use_fields
+ sub.row().prop(rd, "field_order", expand=True)
+ sub.prop(rd, "use_fields_still", text="Still")
+
+ col = split.column()
+ col.prop(rd, "use_edge_enhance")
+ sub = col.column()
+ sub.active = rd.use_edge_enhance
+ sub.prop(rd, "edge_threshold", text="Threshold", slider=True)
+ sub.prop(rd, "edge_color", text="")
+
+
+class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Output"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+ file_format = rd.file_format
+
+ layout.prop(rd, "filepath", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "file_format", text="")
+ col.row().prop(rd, "color_mode", text="Color", expand=True)
+
+ col = split.column()
+ col.prop(rd, "use_file_extension")
+ col.prop(rd, "use_overwrite")
+ col.prop(rd, "use_placeholder")
+
+ if file_format in {'AVI_JPEG', 'JPEG'}:
+ layout.prop(rd, "file_quality", slider=True)
+
+ if file_format == 'PNG':
+ layout.prop(rd, "file_quality", slider=True, text="Compression")
+
+ if file_format in {'OPEN_EXR', 'MULTILAYER'}:
+ row = layout.row()
+ row.prop(rd, "exr_codec", text="Codec")
+
+ if file_format == 'OPEN_EXR':
+ row = layout.row()
+ row.prop(rd, "use_exr_half")
+ row.prop(rd, "exr_zbuf")
+ row.prop(rd, "exr_preview")
+
+ elif file_format == 'JPEG2000':
+ split = layout.split()
+ col = split.column()
+ col.label(text="Depth:")
+ col.row().prop(rd, "jpeg2k_depth", expand=True)
+
+ col = split.column()
+ col.prop(rd, "jpeg2k_preset", text="")
+ col.prop(rd, "jpeg2k_ycc")
+
+ elif file_format in {'CINEON', 'DPX'}:
+
+ split = layout.split()
+ split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
+ '''
+ col = split.column()
+ col.prop(rd, "use_cineon_log", text="Convert to Log")
+
+ col = split.column(align=True)
+ col.active = rd.use_cineon_log
+ col.prop(rd, "cineon_black", text="Black")
+ col.prop(rd, "cineon_white", text="White")
+ col.prop(rd, "cineon_gamma", text="Gamma")
+ '''
+
+ elif file_format == 'TIFF':
+ layout.prop(rd, "use_tiff_16bit")
+
+ elif file_format == 'QUICKTIME_CARBON':
+ layout.operator("scene.render_data_set_quicktime_codec")
+
+ elif file_format == 'QUICKTIME_QTKIT':
+ split = layout.split()
+ col = split.column()
+ col.prop(rd, "quicktime_codec_type", text="Video Codec")
+ col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
+
+ # Audio
+ col.prop(rd, "quicktime_audiocodec_type", text="Audio Codec")
+ if rd.quicktime_audiocodec_type != 'No audio':
+ split = layout.split()
+ if rd.quicktime_audiocodec_type == 'LPCM':
+ split.prop(rd, "quicktime_audio_bitdepth", text="")
+
+ split.prop(rd, "quicktime_audio_samplerate", text="")
+
+ split = layout.split()
+ col = split.column()
+ if rd.quicktime_audiocodec_type == 'AAC':
+ col.prop(rd, "quicktime_audio_bitrate")
+
+ subsplit = split.split()
+ col = subsplit.column()
+
+ if rd.quicktime_audiocodec_type == 'AAC':
+ col.prop(rd, "quicktime_audio_codec_isvbr")
+
+ col = subsplit.column()
+ col.prop(rd, "quicktime_audio_resampling_hq")
+
+
+class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Encoding"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return rd.file_format in {'FFMPEG', 'XVID', 'H264', 'THEORA'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ layout.menu("RENDER_MT_ffmpeg_presets", text="Presets")
+
+ split = layout.split()
+ split.prop(rd, "ffmpeg_format")
+ if rd.ffmpeg_format in {'AVI', 'QUICKTIME', 'MKV', 'OGG'}:
+ split.prop(rd, "ffmpeg_codec")
+ else:
+ split.label()
+
+ row = layout.row()
+ row.prop(rd, "ffmpeg_video_bitrate")
+ row.prop(rd, "ffmpeg_gopsize")
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Rate:")
+ col.prop(rd, "ffmpeg_minrate", text="Minimum")
+ col.prop(rd, "ffmpeg_maxrate", text="Maximum")
+ col.prop(rd, "ffmpeg_buffersize", text="Buffer")
+
+ col = split.column()
+ col.prop(rd, "ffmpeg_autosplit")
+ col.label(text="Mux:")
+ col.prop(rd, "ffmpeg_muxrate", text="Rate")
+ col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
+
+ layout.separator()
+
+ # Audio:
+ if rd.ffmpeg_format not in {'MP3'}:
+ layout.prop(rd, "ffmpeg_audio_codec", text="Audio Codec")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "ffmpeg_audio_bitrate")
+ col.prop(rd, "ffmpeg_audio_mixrate")
+
+ split.prop(rd, "ffmpeg_audio_volume", slider=True)
+
+
+class RENDER_PT_antialiasing(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Anti-Aliasing"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ rd = context.scene.render
+
+ self.layout.prop(rd, "use_antialiasing", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+ layout.active = rd.use_antialiasing
+
+ split = layout.split()
+
+ col = split.column()
+ col.row().prop(rd, "antialiasing_samples", expand=True)
+ sub = col.row()
+ sub.enabled = not rd.use_border
+ sub.prop(rd, "use_full_sample")
+
+ col = split.column()
+ col.prop(rd, "pixel_filter_type", text="")
+ col.prop(rd, "filter_size", text="Size")
+
+
+class RENDER_PT_motion_blur(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Sampled Motion Blur"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return not rd.use_full_sample and (rd.engine in cls.COMPAT_ENGINES)
+
+ def draw_header(self, context):
+ rd = context.scene.render
+
+ self.layout.prop(rd, "use_motion_blur", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+ layout.active = rd.use_motion_blur
+
+ row = layout.row()
+ row.prop(rd, "motion_blur_samples")
+ row.prop(rd, "motion_blur_shutter")
+
+
+class RENDER_PT_dimensions(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Dimensions"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ rd = scene.render
+
+ row = layout.row(align=True)
+ row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
+ row.operator("render.preset_add", text="", icon="ZOOMIN")
+ row.operator("render.preset_add", text="", icon="ZOOMOUT").remove_active = True
+
+ split = layout.split()
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Resolution:")
+ sub.prop(rd, "resolution_x", text="X")
+ sub.prop(rd, "resolution_y", text="Y")
+ sub.prop(rd, "resolution_percentage", text="")
+
+ sub.label(text="Aspect Ratio:")
+ sub.prop(rd, "pixel_aspect_x", text="X")
+ sub.prop(rd, "pixel_aspect_y", text="Y")
+
+ row = col.row()
+ row.prop(rd, "use_border", text="Border")
+ sub = row.row()
+ sub.active = rd.use_border
+ sub.prop(rd, "use_crop_to_border", text="Crop")
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Frame Range:")
+ sub.prop(scene, "frame_start", text="Start")
+ sub.prop(scene, "frame_end", text="End")
+ sub.prop(scene, "frame_step", text="Step")
+
+ sub.label(text="Frame Rate:")
+ if rd.fps_base == 1:
+ fps_rate = round(rd.fps / rd.fps_base)
+ else:
+ fps_rate = round(rd.fps / rd.fps_base, 2)
+
+ # TODO: Change the following to iterate over existing presets
+ custom_framerate = (fps_rate not in {23.98, 24, 25, 29.97, 30, 50, 59.94, 60})
+
+ if custom_framerate == True:
+ fps_label_text = "Custom (" + str(fps_rate) + " fps)"
+ else:
+ fps_label_text = str(fps_rate) + " fps"
+
+ sub.menu("RENDER_MT_framerate_presets", text=fps_label_text)
+
+ if custom_framerate or (bpy.types.RENDER_MT_framerate_presets.bl_label == "Custom"):
+ sub.prop(rd, "fps")
+ sub.prop(rd, "fps_base", text="/")
+ subrow = sub.row(align=True)
+ subrow.label(text="Time Remapping:")
+ subrow = sub.row(align=True)
+ subrow.prop(rd, "frame_map_old", text="Old")
+ subrow.prop(rd, "frame_map_new", text="New")
+
+
+class RENDER_PT_stamp(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Stamp"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ rd = context.scene.render
+
+ self.layout.prop(rd, "use_stamp", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ layout.active = rd.use_stamp
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "use_stamp_time", text="Time")
+ col.prop(rd, "use_stamp_date", text="Date")
+ col.prop(rd, "use_stamp_render_time", text="RenderTime")
+ col.prop(rd, "use_stamp_frame", text="Frame")
+ col.prop(rd, "use_stamp_scene", text="Scene")
+ col.prop(rd, "use_stamp_camera", text="Camera")
+ col.prop(rd, "use_stamp_lens", text="Lens")
+ col.prop(rd, "use_stamp_filename", text="Filename")
+ col.prop(rd, "use_stamp_marker", text="Marker")
+ col.prop(rd, "use_stamp_sequencer_strip", text="Seq. Strip")
+
+ col = split.column()
+ col.active = rd.use_stamp
+ col.prop(rd, "stamp_foreground", slider=True)
+ col.prop(rd, "stamp_background", slider=True)
+ col.separator()
+ col.prop(rd, "stamp_font_size", text="Font Size")
+
+ row = layout.split(percentage=0.2)
+ row.prop(rd, "use_stamp_note", text="Note")
+ sub = row.row()
+ sub.active = rd.use_stamp_note
+ sub.prop(rd, "stamp_note_text", text="")
+
+
+class RENDER_PT_bake(RenderButtonsPanel, bpy.types.Panel):
+ bl_label = "Bake"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ rd = context.scene.render
+
+ layout.operator("object.bake_image", icon='RENDER_STILL')
+
+ layout.prop(rd, "bake_type")
+
+ if rd.bake_type == 'NORMALS':
+ layout.prop(rd, "bake_normal_space")
+ elif rd.bake_type in {'DISPLACEMENT', 'AO'}:
+ layout.prop(rd, "use_bake_normalize")
+
+ # col.prop(rd, "bake_aa_mode")
+ # col.prop(rd, "use_bake_antialiasing")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "use_bake_clear")
+ col.prop(rd, "bake_margin")
+ col.prop(rd, "bake_quad_split", text="Split")
+
+ col = split.column()
+ col.prop(rd, "use_bake_selected_to_active")
+ sub = col.column()
+ sub.active = rd.use_bake_selected_to_active
+ sub.prop(rd, "bake_distance")
+ sub.prop(rd, "bake_bias")
diff --git a/release/scripts/startup/bl_ui/properties_scene.py b/release/scripts/startup/bl_ui/properties_scene.py
new file mode 100644
index 00000000000..0f25523b586
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_scene.py
@@ -0,0 +1,303 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class SceneButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "scene"
+
+ @classmethod
+ def poll(cls, context):
+ return context.scene
+
+
+class SCENE_PT_scene(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Scene"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+
+ layout.prop(scene, "camera")
+ layout.prop(scene, "background_set", text="Background")
+
+
+class SCENE_PT_unit(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Units"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+ unit = context.scene.unit_settings
+
+ col = layout.column()
+ col.row().prop(unit, "system", expand=True)
+ col.row().prop(unit, "system_rotation", expand=True)
+
+ row = layout.row()
+ row.active = (unit.system != 'NONE')
+ row.prop(unit, "scale_length", text="Scale")
+ row.prop(unit, "use_separate")
+
+
+class SCENE_PT_keying_sets(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Keying Sets"
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ row = layout.row()
+
+ col = row.column()
+ col.template_list(scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
+ col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
+
+ ks = scene.keying_sets.active
+ if ks and ks.is_path_absolute:
+ row = layout.row()
+
+ col = row.column()
+ col.prop(ks, "name")
+
+ subcol = col.column()
+ subcol.operator_context = 'INVOKE_DEFAULT'
+ op = subcol.operator("anim.keying_set_export", text="Export to File")
+ op.filepath = "keyingset.py"
+
+ col = row.column()
+ col.label(text="Keyframing Settings:")
+ col.prop(ks, "bl_options")
+
+
+class SCENE_PT_keying_set_paths(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Active Keying Set"
+
+ @classmethod
+ def poll(cls, context):
+ ks = context.scene.keying_sets.active
+ return (ks and ks.is_path_absolute)
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ ks = scene.keying_sets.active
+
+ row = layout.row()
+ row.label(text="Paths:")
+
+ row = layout.row()
+
+ col = row.column()
+ col.template_list(ks, "paths", ks.paths, "active_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
+ col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
+
+ ksp = ks.paths.active
+ if ksp:
+ col = layout.column()
+ col.label(text="Target:")
+ col.template_any_ID(ksp, "id", "id_type")
+ col.template_path_builder(ksp, "data_path", ksp.id)
+
+ row = layout.row()
+
+ col = row.column()
+ col.label(text="Array Target:")
+ col.prop(ksp, "use_entire_array")
+ if ksp.use_entire_array is False:
+ col.prop(ksp, "array_index")
+
+ col = row.column()
+ col.label(text="F-Curve Grouping:")
+ col.prop(ksp, "group_method")
+ if ksp.group_method == 'NAMED':
+ col.prop(ksp, "group")
+
+ col.prop(ksp, "bl_options")
+
+
+class SCENE_PT_physics(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Gravity"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ self.layout.prop(context.scene, "use_gravity", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+
+ layout.active = scene.use_gravity
+
+ layout.prop(scene, "gravity", text="")
+
+
+class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
+ bl_label = "Simplify"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ scene = context.scene
+ rd = scene.render
+ self.layout.prop(rd, "use_simplify", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+ rd = scene.render
+
+ layout.active = rd.use_simplify
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(rd, "simplify_subdivision", text="Subdivision")
+ col.prop(rd, "simplify_child_particles", text="Child Particles")
+
+ col.prop(rd, "use_simplify_triangulate")
+
+ col = split.column()
+ col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
+ col.prop(rd, "simplify_ao_sss", text="AO and SSS")
+
+
+class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "scene"
+ _property_type = bpy.types.Scene
+
+# XXX, move operator to op/ dir
+
+
+class ANIM_OT_keying_set_export(bpy.types.Operator):
+ "Export Keying Set to a python script."
+ bl_idname = "anim.keying_set_export"
+ bl_label = "Export Keying Set..."
+
+ filepath = bpy.props.StringProperty(name="File Path", description="Filepath to write file to.")
+ filter_folder = bpy.props.BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
+ filter_text = bpy.props.BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
+ filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ if not self.filepath:
+ raise Exception("Filepath not set.")
+
+ f = open(self.filepath, "w")
+ if not f:
+ raise Exception("Could not open file.")
+
+ scene = context.scene
+ ks = scene.keying_sets.active
+
+ f.write("# Keying Set: %s\n" % ks.name)
+
+ f.write("import bpy\n\n")
+ f.write("scene= bpy.data.scenes[0]\n\n") # XXX, why not use the current scene?
+
+ # Add KeyingSet and set general settings
+ f.write("# Keying Set Level declarations\n")
+ f.write("ks= scene.keying_sets.new(name=\"%s\")\n" % ks.name)
+
+ if not ks.is_path_absolute:
+ f.write("ks.is_path_absolute = False\n")
+ f.write("\n")
+
+ f.write("ks.bl_options = %r\n" % ks.bl_options)
+ f.write("\n")
+
+ # generate and write set of lookups for id's used in paths
+ id_to_paths_cache = {} # cache for syncing ID-blocks to bpy paths + shorthands
+
+ for ksp in ks.paths:
+ if ksp.id is None:
+ continue
+ if ksp.id in id_to_paths_cache:
+ continue
+
+ # - idtype_list is used to get the list of id-datablocks from bpy.data.*
+ # since this info isn't available elsewhere
+ # - id.bl_rna.name gives a name suitable for UI,
+ # with a capitalised first letter, but we need
+ # the plural form that's all lower case
+ idtype_list = ksp.id.bl_rna.name.lower() + "s"
+ id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
+
+ # shorthand ID for the ID-block (as used in the script)
+ short_id = "id_%d" % len(id_to_paths_cache)
+
+ # store this in the cache now
+ id_to_paths_cache[ksp.id] = [short_id, id_bpy_path]
+
+ f.write("# ID's that are commonly used\n")
+ for id_pair in id_to_paths_cache.values():
+ f.write("%s = %s\n" % (id_pair[0], id_pair[1]))
+ f.write("\n")
+
+ # write paths
+ f.write("# Path Definitions\n")
+ for ksp in ks.paths:
+ f.write("ksp = ks.paths.add(")
+
+ # id-block + data_path
+ if ksp.id:
+ # find the relevant shorthand from the cache
+ id_bpy_path = id_to_paths_cache[ksp.id][0]
+ else:
+ id_bpy_path = "None" # XXX...
+ f.write("%s, '%s'" % (id_bpy_path, ksp.data_path))
+
+ # array index settings (if applicable)
+ if ksp.use_entire_array:
+ f.write(", index=-1")
+ else:
+ f.write(", index=%d" % ksp.array_index)
+
+ # grouping settings (if applicable)
+ # NOTE: the current default is KEYINGSET, but if this changes, change this code too
+ if ksp.group_method == 'NAMED':
+ f.write(", group_method='%s', group_name=\"%s\"" % (ksp.group_method, ksp.group))
+ elif ksp.group_method != 'KEYINGSET':
+ f.write(", group_method='%s'" % ksp.group_method)
+
+ # finish off
+ f.write(")\n")
+
+ f.write("\n")
+ f.close()
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
diff --git a/release/scripts/startup/bl_ui/properties_texture.py b/release/scripts/startup/bl_ui/properties_texture.py
new file mode 100644
index 00000000000..7e289f1ecce
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_texture.py
@@ -0,0 +1,1030 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+
+class TEXTURE_MT_specials(bpy.types.Menu):
+ bl_label = "Texture Specials"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("texture.slot_copy", icon='COPYDOWN')
+ layout.operator("texture.slot_paste", icon='PASTEDOWN')
+
+
+class TEXTURE_MT_envmap_specials(bpy.types.Menu):
+ bl_label = "Environment Map Specials"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("texture.envmap_save", icon='IMAGEFILE')
+ layout.operator("texture.envmap_clear", icon='FILE_REFRESH')
+ layout.operator("texture.envmap_clear_all", icon='FILE_REFRESH')
+
+from bl_ui.properties_material import active_node_mat
+
+
+def context_tex_datablock(context):
+ idblock = context.material
+ if idblock:
+ return active_node_mat(idblock)
+
+ idblock = context.lamp
+ if idblock:
+ return idblock
+
+ idblock = context.world
+ if idblock:
+ return idblock
+
+ idblock = context.brush
+ if idblock:
+ return idblock
+
+ if context.particle_system:
+ idblock = context.particle_system.settings
+
+ return idblock
+
+
+class TextureButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "texture"
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ return tex and (tex.type != 'NONE' or tex.use_nodes) and (context.scene.render.engine in cls.COMPAT_ENGINES)
+
+
+class TEXTURE_PT_context_texture(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ engine = context.scene.render.engine
+ if not hasattr(context, "texture_slot"):
+ return False
+ return ((context.material or context.world or context.lamp or context.brush or context.texture or context.particle_system or isinstance(context.space_data.pin_id, bpy.types.ParticleSettings))
+ and (engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+ slot = context.texture_slot
+ node = context.texture_node
+ space = context.space_data
+ tex = context.texture
+ idblock = context_tex_datablock(context)
+ pin_id = space.pin_id
+
+ if space.use_pin_id and not isinstance(pin_id, bpy.types.Texture):
+ idblock = pin_id
+ pin_id = None
+
+ if not space.use_pin_id:
+ layout.prop(space, "texture_context", expand=True)
+
+ tex_collection = (pin_id is None) and (node is None) and (not isinstance(idblock, bpy.types.Brush))
+
+ if tex_collection:
+ row = layout.row()
+
+ row.template_list(idblock, "texture_slots", idblock, "active_texture_index", rows=2)
+
+ col = row.column(align=True)
+ col.operator("texture.slot_move", text="", icon='TRIA_UP').type = 'UP'
+ col.operator("texture.slot_move", text="", icon='TRIA_DOWN').type = 'DOWN'
+ col.menu("TEXTURE_MT_specials", icon='DOWNARROW_HLT', text="")
+
+ split = layout.split(percentage=0.65)
+ col = split.column()
+
+ if tex_collection:
+ col.template_ID(idblock, "active_texture", new="texture.new")
+ elif node:
+ col.template_ID(node, "texture", new="texture.new")
+ elif idblock:
+ col.template_ID(idblock, "texture", new="texture.new")
+
+ if pin_id:
+ col.template_ID(space, "pin_id")
+
+ col = split.column()
+
+ if tex:
+ split = layout.split(percentage=0.2)
+
+ if tex.use_nodes:
+
+ if slot:
+ split.label(text="Output:")
+ split.prop(slot, "output_node", text="")
+
+ else:
+ split.label(text="Type:")
+ split.prop(tex, "type", text="")
+
+
+class TEXTURE_PT_preview(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ slot = getattr(context, "texture_slot", None)
+ idblock = context_tex_datablock(context)
+
+ if idblock:
+ layout.template_preview(tex, parent=idblock, slot=slot)
+ else:
+ layout.template_preview(tex, slot=slot)
+
+
+class TEXTURE_PT_colors(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Colors"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "use_color_ramp", text="Ramp")
+ if tex.use_color_ramp:
+ layout.template_color_ramp(tex, "color_ramp", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="RGB Multiply:")
+ sub = col.column(align=True)
+ sub.prop(tex, "factor_red", text="R")
+ sub.prop(tex, "factor_green", text="G")
+ sub.prop(tex, "factor_blue", text="B")
+
+ col = split.column()
+ col.label(text="Adjust:")
+ col.prop(tex, "intensity")
+ col.prop(tex, "contrast")
+ col.prop(tex, "saturation")
+
+# Texture Slot Panels #
+
+
+class TextureSlotPanel(TextureButtonsPanel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ if not hasattr(context, "texture_slot"):
+ return False
+
+ engine = context.scene.render.engine
+ return TextureButtonsPanel.poll(self, context) and (engine in cls.COMPAT_ENGINES)
+
+
+# Texture Type Panels #
+
+
+class TextureTypePanel(TextureButtonsPanel):
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ engine = context.scene.render.engine
+ return tex and ((tex.type == cls.tex_type and not tex.use_nodes) and (engine in cls.COMPAT_ENGINES))
+
+
+class TEXTURE_PT_clouds(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Clouds"
+ tex_type = 'CLOUDS'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "cloud_type", expand=True)
+ layout.label(text="Noise:")
+ layout.prop(tex, "noise_type", text="Type", expand=True)
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "noise_scale", text="Size")
+ col.prop(tex, "noise_depth", text="Depth")
+
+ split.prop(tex, "nabla", text="Nabla")
+
+
+class TEXTURE_PT_wood(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Wood"
+ tex_type = 'WOOD'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "noisebasis_2", expand=True)
+ layout.prop(tex, "wood_type", expand=True)
+
+ col = layout.column()
+ col.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
+ col.label(text="Noise:")
+ col.row().prop(tex, "noise_type", text="Type", expand=True)
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ split = layout.split()
+ split.active = tex.wood_type in {'RINGNOISE', 'BANDNOISE'}
+
+ col = split.column()
+ col.prop(tex, "noise_scale", text="Size")
+ col.prop(tex, "turbulence")
+
+ split.prop(tex, "nabla")
+
+
+class TEXTURE_PT_marble(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Marble"
+ tex_type = 'MARBLE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "marble_type", expand=True)
+ layout.prop(tex, "noisebasis_2", expand=True)
+ layout.label(text="Noise:")
+ layout.prop(tex, "noise_type", text="Type", expand=True)
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "noise_scale", text="Size")
+ col.prop(tex, "noise_depth", text="Depth")
+
+ col = split.column()
+ col.prop(tex, "turbulence")
+ col.prop(tex, "nabla")
+
+
+class TEXTURE_PT_magic(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Magic"
+ tex_type = 'MAGIC'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ row = layout.row()
+ row.prop(tex, "noise_depth", text="Depth")
+ row.prop(tex, "turbulence")
+
+
+class TEXTURE_PT_blend(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Blend"
+ tex_type = 'BLEND'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "progression")
+
+ sub = layout.row()
+
+ sub.active = (tex.progression in {'LINEAR', 'QUADRATIC', 'EASING', 'RADIAL'})
+ sub.prop(tex, "use_flip_axis", expand=True)
+
+
+class TEXTURE_PT_stucci(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Stucci"
+ tex_type = 'STUCCI'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "stucci_type", expand=True)
+ layout.label(text="Noise:")
+ layout.prop(tex, "noise_type", text="Type", expand=True)
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ row = layout.row()
+ row.prop(tex, "noise_scale", text="Size")
+ row.prop(tex, "turbulence")
+
+
+class TEXTURE_PT_image(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Image"
+ tex_type = 'IMAGE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.template_image(tex, "image", tex.image_user)
+
+
+def texture_filter_common(tex, layout):
+ layout.label(text="Filter:")
+ layout.prop(tex, "filter_type", text="")
+ if tex.use_mipmap and tex.filter_type in {'AREA', 'EWA', 'FELINE'}:
+ if tex.filter_type == 'FELINE':
+ layout.prop(tex, "filter_probes", text="Probes")
+ else:
+ layout.prop(tex, "filter_eccentricity", text="Eccentricity")
+
+ layout.prop(tex, "filter_size")
+ layout.prop(tex, "use_filter_size_min")
+
+
+class TEXTURE_PT_image_sampling(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Image Sampling"
+ bl_options = {'DEFAULT_CLOSED'}
+ tex_type = 'IMAGE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ idblock = context_tex_datablock(context)
+ tex = context.texture
+ slot = context.texture_slot
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Alpha:")
+ col.prop(tex, "use_alpha", text="Use")
+ col.prop(tex, "use_calculate_alpha", text="Calculate")
+ col.prop(tex, "invert_alpha", text="Invert")
+ col.separator()
+ col.prop(tex, "use_flip_axis", text="Flip X/Y Axis")
+
+ col = split.column()
+
+ #Only for Material based textures, not for Lamp/World...
+ if isinstance(idblock, bpy.types.Material):
+ col.prop(tex, "use_normal_map")
+ row = col.row()
+ row.active = tex.use_normal_map
+ row.prop(slot, "normal_map_space", text="")
+
+ col.prop(tex, "use_mipmap")
+ row = col.row()
+ row.active = tex.use_mipmap
+ row.prop(tex, "use_mipmap_gauss")
+ col.prop(tex, "use_interpolation")
+
+ texture_filter_common(tex, col)
+
+
+class TEXTURE_PT_image_mapping(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Image Mapping"
+ bl_options = {'DEFAULT_CLOSED'}
+ tex_type = 'IMAGE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "extension")
+
+ split = layout.split()
+
+ if tex.extension == 'REPEAT':
+ col = split.column(align=True)
+ col.label(text="Repeat:")
+ col.prop(tex, "repeat_x", text="X")
+ col.prop(tex, "repeat_y", text="Y")
+
+ col = split.column(align=True)
+ col.label(text="Mirror:")
+ row = col.row()
+ row.prop(tex, "use_mirror_x", text="X")
+ row.active = (tex.repeat_x > 1)
+ row = col.row()
+ row.prop(tex, "use_mirror_y", text="Y")
+ row.active = (tex.repeat_y > 1)
+ layout.separator()
+
+ elif tex.extension == 'CHECKER':
+ col = split.column(align=True)
+ row = col.row()
+ row.prop(tex, "use_checker_even", text="Even")
+ row.prop(tex, "use_checker_odd", text="Odd")
+
+ col = split.column()
+ col.prop(tex, "checker_distance", text="Distance")
+
+ layout.separator()
+
+ split = layout.split()
+
+ col = split.column(align=True)
+ #col.prop(tex, "crop_rectangle")
+ col.label(text="Crop Minimum:")
+ col.prop(tex, "crop_min_x", text="X")
+ col.prop(tex, "crop_min_y", text="Y")
+
+ col = split.column(align=True)
+ col.label(text="Crop Maximum:")
+ col.prop(tex, "crop_max_x", text="X")
+ col.prop(tex, "crop_max_y", text="Y")
+
+
+class TEXTURE_PT_envmap(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Environment Map"
+ tex_type = 'ENVIRONMENT_MAP'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ env = tex.environment_map
+
+ row = layout.row()
+ row.prop(env, "source", expand=True)
+ row.menu("TEXTURE_MT_envmap_specials", icon='DOWNARROW_HLT', text="")
+
+ if env.source == 'IMAGE_FILE':
+ layout.template_ID(tex, "image", open="image.open")
+ layout.template_image(tex, "image", tex.image_user, compact=True)
+ else:
+ layout.prop(env, "mapping")
+ if env.mapping == 'PLANE':
+ layout.prop(env, "zoom")
+ layout.prop(env, "viewpoint_object")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(env, "layers_ignore")
+ col.prop(env, "resolution")
+ col.prop(env, "depth")
+
+ col = split.column(align=True)
+
+ col.label(text="Clipping:")
+ col.prop(env, "clip_start", text="Start")
+ col.prop(env, "clip_end", text="End")
+
+
+class TEXTURE_PT_envmap_sampling(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Environment Map Sampling"
+ bl_options = {'DEFAULT_CLOSED'}
+ tex_type = 'ENVIRONMENT_MAP'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ texture_filter_common(tex, layout)
+
+
+class TEXTURE_PT_musgrave(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Musgrave"
+ tex_type = 'MUSGRAVE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "musgrave_type")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "dimension_max", text="Dimension")
+ col.prop(tex, "lacunarity")
+ col.prop(tex, "octaves")
+
+ musgrave_type = tex.musgrave_type
+ col = split.column()
+ if musgrave_type in {'HETERO_TERRAIN', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
+ col.prop(tex, "offset")
+ if musgrave_type in {'MULTIFRACTAL', 'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
+ col.prop(tex, "noise_intensity", text="Intensity")
+ if musgrave_type in {'RIDGED_MULTIFRACTAL', 'HYBRID_MULTIFRACTAL'}:
+ col.prop(tex, "gain")
+
+ layout.label(text="Noise:")
+
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ row = layout.row()
+ row.prop(tex, "noise_scale", text="Size")
+ row.prop(tex, "nabla")
+
+
+class TEXTURE_PT_voronoi(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Voronoi"
+ tex_type = 'VORONOI'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Distance Metric:")
+ col.prop(tex, "distance_metric", text="")
+ sub = col.column()
+ sub.active = tex.distance_metric == 'MINKOVSKY'
+ sub.prop(tex, "minkovsky_exponent", text="Exponent")
+ col.label(text="Coloring:")
+ col.prop(tex, "color_mode", text="")
+ col.prop(tex, "noise_intensity", text="Intensity")
+
+ col = split.column()
+ sub = col.column(align=True)
+ sub.label(text="Feature Weights:")
+ sub.prop(tex, "weight_1", text="1", slider=True)
+ sub.prop(tex, "weight_2", text="2", slider=True)
+ sub.prop(tex, "weight_3", text="3", slider=True)
+ sub.prop(tex, "weight_4", text="4", slider=True)
+
+ layout.label(text="Noise:")
+ row = layout.row()
+ row.prop(tex, "noise_scale", text="Size")
+ row.prop(tex, "nabla")
+
+
+class TEXTURE_PT_distortednoise(TextureTypePanel, bpy.types.Panel):
+ bl_label = "Distorted Noise"
+ tex_type = 'DISTORTED_NOISE'
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+
+ layout.prop(tex, "noise_distortion")
+ layout.prop(tex, "noise_basis", text="Basis")
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "distortion", text="Distortion")
+ col.prop(tex, "noise_scale", text="Size")
+
+ split.prop(tex, "nabla")
+
+
+class TEXTURE_PT_voxeldata(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Voxel Data"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ engine = context.scene.render.engine
+ return tex and (tex.type == 'VOXEL_DATA' and (engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ vd = tex.voxel_data
+
+ layout.prop(vd, "file_format")
+ if vd.file_format in {'BLENDER_VOXEL', 'RAW_8BIT'}:
+ layout.prop(vd, "filepath")
+ if vd.file_format == 'RAW_8BIT':
+ layout.prop(vd, "resolution")
+ elif vd.file_format == 'SMOKE':
+ layout.prop(vd, "domain_object")
+ layout.prop(vd, "smoke_data_type")
+ elif vd.file_format == 'IMAGE_SEQUENCE':
+ layout.template_ID(tex, "image", open="image.open")
+ layout.template_image(tex, "image", tex.image_user, compact=True)
+ #layout.prop(vd, "frame_duration")
+
+ if vd.file_format in {'BLENDER_VOXEL', 'RAW_8BIT'}:
+ layout.prop(vd, "use_still_frame")
+ row = layout.row()
+ row.active = vd.use_still_frame
+ row.prop(vd, "still_frame")
+
+ layout.prop(vd, "interpolation")
+ layout.prop(vd, "extension")
+ layout.prop(vd, "intensity")
+
+
+class TEXTURE_PT_pointdensity(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Point Density"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ engine = context.scene.render.engine
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ pd = tex.point_density
+
+ layout.prop(pd, "point_source", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ if pd.point_source == 'PARTICLE_SYSTEM':
+ col.label(text="Object:")
+ col.prop(pd, "object", text="")
+
+ sub = col.column()
+ sub.enabled = bool(pd.object)
+ if pd.object:
+ sub.label(text="System:")
+ sub.prop_search(pd, "particle_system", pd.object, "particle_systems", text="")
+ sub.label(text="Cache:")
+ sub.prop(pd, "particle_cache_space", text="")
+ else:
+ col.label(text="Object:")
+ col.prop(pd, "object", text="")
+ col.label(text="Cache:")
+ col.prop(pd, "vertex_cache_space", text="")
+
+ col.separator()
+
+ if pd.point_source == 'PARTICLE_SYSTEM':
+ col.label(text="Color Source:")
+ col.prop(pd, "color_source", text="")
+ if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_VELOCITY'}:
+ col.prop(pd, "speed_scale")
+ if pd.color_source in {'PARTICLE_SPEED', 'PARTICLE_AGE'}:
+ layout.template_color_ramp(pd, "color_ramp", expand=True)
+
+ col = split.column()
+ col.label()
+ col.prop(pd, "radius")
+ col.label(text="Falloff:")
+ col.prop(pd, "falloff", text="")
+ if pd.falloff == 'SOFT':
+ col.prop(pd, "falloff_soft")
+
+
+class TEXTURE_PT_pointdensity_turbulence(TextureButtonsPanel, bpy.types.Panel):
+ bl_label = "Turbulence"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ engine = context.scene.render.engine
+ return tex and (tex.type == 'POINT_DENSITY' and (engine in cls.COMPAT_ENGINES))
+
+ def draw_header(self, context):
+ pd = context.texture.point_density
+
+ self.layout.prop(pd, "use_turbulence", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ pd = tex.point_density
+ layout.active = pd.use_turbulence
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Influence:")
+ col.prop(pd, "turbulence_influence", text="")
+ col.label(text="Noise Basis:")
+ col.prop(pd, "noise_basis", text="")
+
+ col = split.column()
+ col.label()
+ col.prop(pd, "turbulence_scale")
+ col.prop(pd, "turbulence_depth")
+ col.prop(pd, "turbulence_strength")
+
+
+class TEXTURE_PT_mapping(TextureSlotPanel, bpy.types.Panel):
+ bl_label = "Mapping"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ idblock = context_tex_datablock(context)
+ if isinstance(idblock, bpy.types.Brush) and not context.sculpt_object:
+ return False
+
+ if not getattr(context, "texture_slot", None):
+ return False
+
+ engine = context.scene.render.engine
+ return (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ idblock = context_tex_datablock(context)
+
+ tex = context.texture_slot
+ # textype = context.texture
+
+ if not isinstance(idblock, bpy.types.Brush):
+ split = layout.split(percentage=0.3)
+ col = split.column()
+ col.label(text="Coordinates:")
+ col = split.column()
+ col.prop(tex, "texture_coords", text="")
+
+ if tex.texture_coords == 'ORCO':
+ """
+ ob = context.object
+ if ob and ob.type == 'MESH':
+ split = layout.split(percentage=0.3)
+ split.label(text="Mesh:")
+ split.prop(ob.data, "texco_mesh", text="")
+ """
+ elif tex.texture_coords == 'UV':
+ split = layout.split(percentage=0.3)
+ split.label(text="Layer:")
+ ob = context.object
+ if ob and ob.type == 'MESH':
+ split.prop_search(tex, "uv_layer", ob.data, "uv_textures", text="")
+ else:
+ split.prop(tex, "uv_layer", text="")
+
+ elif tex.texture_coords == 'OBJECT':
+ split = layout.split(percentage=0.3)
+ split.label(text="Object:")
+ split.prop(tex, "object", text="")
+
+ if isinstance(idblock, bpy.types.Brush):
+ if context.sculpt_object:
+ layout.label(text="Brush Mapping:")
+ layout.prop(tex, "map_mode", expand=True)
+
+ row = layout.row()
+ row.active = tex.map_mode in {'FIXED', 'TILED'}
+ row.prop(tex, "angle")
+ else:
+ if isinstance(idblock, bpy.types.Material):
+ split = layout.split(percentage=0.3)
+ split.label(text="Projection:")
+ split.prop(tex, "mapping", text="")
+
+ split = layout.split()
+
+ col = split.column()
+ if tex.texture_coords in {'ORCO', 'UV'}:
+ col.prop(tex, "use_from_dupli")
+ elif tex.texture_coords == 'OBJECT':
+ col.prop(tex, "use_from_original")
+ else:
+ col.label()
+
+ col = split.column()
+ row = col.row()
+ row.prop(tex, "mapping_x", text="")
+ row.prop(tex, "mapping_y", text="")
+ row.prop(tex, "mapping_z", text="")
+
+ row = layout.row()
+ row.column().prop(tex, "offset")
+ row.column().prop(tex, "scale")
+
+
+class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
+ bl_label = "Influence"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+
+ @classmethod
+ def poll(cls, context):
+ idblock = context_tex_datablock(context)
+ if isinstance(idblock, bpy.types.Brush):
+ return False
+
+ if not getattr(context, "texture_slot", None):
+ return False
+
+ engine = context.scene.render.engine
+ return (engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+
+ layout = self.layout
+
+ idblock = context_tex_datablock(context)
+
+ # textype = context.texture
+ tex = context.texture_slot
+
+ def factor_but(layout, toggle, factor, name):
+ row = layout.row(align=True)
+ row.prop(tex, toggle, text="")
+ sub = row.row()
+ sub.active = getattr(tex, toggle)
+ sub.prop(tex, factor, text=name, slider=True)
+ return sub # XXX, temp. use_map_normal needs to override.
+
+ if isinstance(idblock, bpy.types.Material):
+ if idblock.type in {'SURFACE', 'WIRE'}:
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Diffuse:")
+ factor_but(col, "use_map_diffuse", "diffuse_factor", "Intensity")
+ factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+ factor_but(col, "use_map_translucency", "translucency_factor", "Translucency")
+
+ col.label(text="Specular:")
+ factor_but(col, "use_map_specular", "specular_factor", "Intensity")
+ factor_but(col, "use_map_color_spec", "specular_color_factor", "Color")
+ factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
+
+ col = split.column()
+ col.label(text="Shading:")
+ factor_but(col, "use_map_ambient", "ambient_factor", "Ambient")
+ factor_but(col, "use_map_emit", "emit_factor", "Emit")
+ factor_but(col, "use_map_mirror", "mirror_factor", "Mirror")
+ factor_but(col, "use_map_raymir", "raymir_factor", "Ray Mirror")
+
+ col.label(text="Geometry:")
+ # XXX replace 'or' when displacement is fixed to not rely on normal influence value.
+ sub_tmp = factor_but(col, "use_map_normal", "normal_factor", "Normal")
+ sub_tmp.active = (tex.use_map_normal or tex.use_map_displacement)
+ # END XXX
+
+ factor_but(col, "use_map_warp", "warp_factor", "Warp")
+ factor_but(col, "use_map_displacement", "displacement_factor", "Displace")
+
+ #sub = col.column()
+ #sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
+ #sub.prop(tex, "default_value", text="Amount", slider=True)
+ elif idblock.type == 'HALO':
+ layout.label(text="Halo:")
+
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+ factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+
+ col = split.column()
+ factor_but(col, "use_map_raymir", "raymir_factor", "Size")
+ factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
+ factor_but(col, "use_map_translucency", "translucency_factor", "Add")
+ elif idblock.type == 'VOLUME':
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_density", "density_factor", "Density")
+ factor_but(col, "use_map_emission", "emission_factor", "Emission")
+ factor_but(col, "use_map_scatter", "scattering_factor", "Scattering")
+ factor_but(col, "use_map_reflect", "reflection_factor", "Reflection")
+
+ col = split.column()
+ col.label(text=" ")
+ factor_but(col, "use_map_color_emission", "emission_color_factor", "Emission Color")
+ factor_but(col, "use_map_color_transmission", "transmission_color_factor", "Transmission Color")
+ factor_but(col, "use_map_color_reflection", "reflection_color_factor", "Reflection Color")
+
+ elif isinstance(idblock, bpy.types.Lamp):
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_color", "color_factor", "Color")
+
+ col = split.column()
+ factor_but(col, "use_map_shadow", "shadow_factor", "Shadow")
+
+ elif isinstance(idblock, bpy.types.World):
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_blend", "blend_factor", "Blend")
+ factor_but(col, "use_map_horizon", "horizon_factor", "Horizon")
+
+ col = split.column()
+ factor_but(col, "use_map_zenith_up", "zenith_up_factor", "Zenith Up")
+ factor_but(col, "use_map_zenith_down", "zenith_down_factor", "Zenith Down")
+ elif isinstance(idblock, bpy.types.ParticleSettings):
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="General:")
+ factor_but(col, "use_map_time", "time_factor", "Time")
+ factor_but(col, "use_map_life", "life_factor", "Lifetime")
+ factor_but(col, "use_map_density", "density_factor", "Density")
+ factor_but(col, "use_map_size", "size_factor", "Size")
+
+ col = split.column()
+ col.label(text="Physics:")
+ factor_but(col, "use_map_velocity", "velocity_factor", "Velocity")
+ factor_but(col, "use_map_damp", "damp_factor", "Damp")
+ factor_but(col, "use_map_gravity", "gravity_factor", "Gravity")
+ factor_but(col, "use_map_field", "field_factor", "Force Fields")
+
+ layout.label(text="Hair:")
+
+ split = layout.split()
+
+ col = split.column()
+ factor_but(col, "use_map_length", "length_factor", "Length")
+ factor_but(col, "use_map_clump", "clump_factor", "Clump")
+
+ col = split.column()
+ factor_but(col, "use_map_kink", "kink_factor", "Kink")
+ factor_but(col, "use_map_rough", "rough_factor", "Rough")
+
+ layout.separator()
+
+ if not isinstance(idblock, bpy.types.ParticleSettings):
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex, "blend_type", text="Blend")
+ col.prop(tex, "use_rgb_to_intensity")
+ # color is used on grayscale textures even when use_rgb_to_intensity is disabled.
+ col.prop(tex, "color", text="")
+
+ col = split.column()
+ col.prop(tex, "invert", text="Negative")
+ col.prop(tex, "use_stencil")
+
+ if isinstance(idblock, bpy.types.Material) or isinstance(idblock, bpy.types.World):
+ col.prop(tex, "default_value", text="DVar", slider=True)
+
+ if isinstance(idblock, bpy.types.Material):
+ layout.label(text="Bump Mapping:")
+
+ # only show bump settings if activated but not for normalmap images
+ row = layout.row()
+ row.active = tex.use_map_normal and not (tex.texture.type == 'IMAGE' and tex.texture.use_normal_map)
+
+ row.prop(tex, "bump_method", text="Method")
+
+ sub = row.row()
+ sub.active = tex.bump_method in {'BUMP_DEFAULT', 'BUMP_BEST_QUALITY'}
+ sub.prop(tex, "bump_objectspace", text="Space")
+
+
+class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "texture"
+ _property_type = bpy.types.Texture
diff --git a/release/scripts/startup/bl_ui/properties_world.py b/release/scripts/startup/bl_ui/properties_world.py
new file mode 100644
index 00000000000..1b2dd4e26aa
--- /dev/null
+++ b/release/scripts/startup/bl_ui/properties_world.py
@@ -0,0 +1,267 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from rna_prop_ui import PropertyPanel
+
+# TODO, "color_range" not in the UI
+
+
+class WorldButtonsPanel():
+ bl_space_type = 'PROPERTIES'
+ bl_region_type = 'WINDOW'
+ bl_context = "world"
+ # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
+
+ @classmethod
+ def poll(cls, context):
+ return (context.world and context.scene.render.engine in cls.COMPAT_ENGINES)
+
+
+class WORLD_PT_context_world(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = ""
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ world = context.world
+ space = context.space_data
+
+ texture_count = world and len(world.texture_slots.keys())
+
+ split = layout.split(percentage=0.65)
+ if scene:
+ split.template_ID(scene, "world", new="world.new")
+ elif world:
+ split.template_ID(space, "pin_id")
+
+ if texture_count:
+ split.label(text=str(texture_count), icon='TEXTURE')
+
+
+class WORLD_PT_preview(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Preview"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return (context.world) and (not rd.use_game_engine) and (rd.engine in cls.COMPAT_ENGINES)
+
+ def draw(self, context):
+ self.layout.template_preview(context.world)
+
+
+class WORLD_PT_world(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "World"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+ world = context.world
+
+ row = layout.row()
+ row.prop(world, "use_sky_paper")
+ row.prop(world, "use_sky_blend")
+ row.prop(world, "use_sky_real")
+
+ row = layout.row()
+ row.column().prop(world, "horizon_color")
+ col = row.column()
+ col.prop(world, "zenith_color")
+ col.active = world.use_sky_blend
+ row.column().prop(world, "ambient_color")
+
+
+class WORLD_PT_ambient_occlusion(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Ambient Occlusion"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ light = context.world.light_settings
+ self.layout.prop(light, "use_ambient_occlusion", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ light = context.world.light_settings
+
+ layout.active = light.use_ambient_occlusion
+
+ split = layout.split()
+ split.prop(light, "ao_factor", text="Factor")
+ split.prop(light, "ao_blend_type", text="")
+
+
+class WORLD_PT_environment_lighting(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Environment Lighting"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ light = context.world.light_settings
+ self.layout.prop(light, "use_environment_light", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ light = context.world.light_settings
+
+ layout.active = light.use_environment_light
+
+ split = layout.split()
+ split.prop(light, "environment_energy", text="Energy")
+ split.prop(light, "environment_color", text="")
+
+
+class WORLD_PT_indirect_lighting(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Indirect Lighting"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ light = context.world.light_settings
+ self.layout.prop(light, "use_indirect_light", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ light = context.world.light_settings
+
+ layout.active = light.use_indirect_light and light.gather_method == 'APPROXIMATE'
+
+ split = layout.split()
+ split.prop(light, "indirect_factor", text="Factor")
+ split.prop(light, "indirect_bounces", text="Bounces")
+
+ if light.gather_method == 'RAYTRACE':
+ layout.label(text="Only works with Approximate gather method")
+
+
+class WORLD_PT_gather(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Gather"
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw(self, context):
+ layout = self.layout
+ light = context.world.light_settings
+
+ layout.active = light.use_ambient_occlusion or light.use_environment_light or light.use_indirect_light
+
+ layout.prop(light, "gather_method", expand=True)
+
+ split = layout.split()
+
+ col = split.column()
+ col.label(text="Attenuation:")
+ if light.gather_method == 'RAYTRACE':
+ col.prop(light, "distance")
+ col.prop(light, "use_falloff")
+ sub = col.row()
+ sub.active = light.use_falloff
+ sub.prop(light, "falloff_strength", text="Strength")
+
+ if light.gather_method == 'RAYTRACE':
+ col = split.column()
+
+ col.label(text="Sampling:")
+ col.prop(light, "sample_method", text="")
+
+ sub = col.column()
+ sub.prop(light, "samples")
+
+ if light.sample_method == 'ADAPTIVE_QMC':
+ sub.prop(light, "threshold")
+ sub.prop(light, "adapt_to_speed", slider=True)
+ elif light.sample_method == 'CONSTANT_JITTERED':
+ sub.prop(light, "bias")
+
+ if light.gather_method == 'APPROXIMATE':
+ col = split.column()
+
+ col.label(text="Sampling:")
+ col.prop(light, "passes")
+ col.prop(light, "error_threshold", text="Error")
+ col.prop(light, "use_cache")
+ col.prop(light, "correction")
+
+
+class WORLD_PT_mist(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Mist"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ world = context.world
+
+ self.layout.prop(world.mist_settings, "use_mist", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ world = context.world
+
+ layout.active = world.mist_settings.use_mist
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(world.mist_settings, "intensity", slider=True)
+ col.prop(world.mist_settings, "start")
+
+ col = split.column()
+ col.prop(world.mist_settings, "depth")
+ col.prop(world.mist_settings, "height")
+
+ layout.prop(world.mist_settings, "falloff")
+
+
+class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
+ bl_label = "Stars"
+ bl_options = {'DEFAULT_CLOSED'}
+ COMPAT_ENGINES = {'BLENDER_RENDER'}
+
+ def draw_header(self, context):
+ world = context.world
+
+ self.layout.prop(world.star_settings, "use_stars", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ world = context.world
+
+ layout.active = world.star_settings.use_stars
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(world.star_settings, "size")
+ col.prop(world.star_settings, "color_random", text="Colors")
+
+ col = split.column()
+ col.prop(world.star_settings, "distance_min", text="Min. Dist")
+ col.prop(world.star_settings, "average_separation", text="Separation")
+
+
+class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _context_path = "world"
+ _property_type = bpy.types.World
diff --git a/release/scripts/startup/bl_ui/space_console.py b/release/scripts/startup/bl_ui/space_console.py
new file mode 100644
index 00000000000..591765c1543
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_console.py
@@ -0,0 +1,160 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+from bpy.props import StringProperty
+
+
+class CONSOLE_HT_header(bpy.types.Header):
+ bl_space_type = 'CONSOLE'
+
+ def draw(self, context):
+ layout = self.layout
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("CONSOLE_MT_console")
+
+ row = layout.row(align=True)
+ row.operator("console.autocomplete", text="Autocomplete")
+
+
+class CONSOLE_MT_console(bpy.types.Menu):
+ bl_label = "Console"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.column()
+ layout.operator("console.clear")
+ layout.operator("console.copy")
+ layout.operator("console.paste")
+ layout.menu("CONSOLE_MT_language")
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class CONSOLE_MT_language(bpy.types.Menu):
+ bl_label = "Languages..."
+
+ def draw(self, context):
+ import sys
+
+ layout = self.layout
+ layout.column()
+
+ # Collect modules with 'console_*.execute'
+ languages = []
+ for modname, mod in sys.modules.items():
+ if modname.startswith("console_") and hasattr(mod, "execute"):
+ languages.append(modname.split('_', 1)[-1])
+
+ languages.sort()
+
+ for language in languages:
+ layout.operator("console.language", text=language[0].upper() + language[1:]).language = language
+
+
+def add_scrollback(text, text_type):
+ for l in text.split('\n'):
+ bpy.ops.console.scrollback_append(text=l.replace('\t', ' '),
+ type=text_type)
+
+
+class ConsoleExec(bpy.types.Operator):
+ '''Execute the current console line as a python expression'''
+ bl_idname = "console.execute"
+ bl_label = "Console Execute"
+
+ def execute(self, context):
+ sc = context.space_data
+
+ module = __import__("console_" + sc.language)
+ execute = getattr(module, "execute", None)
+
+ if execute:
+ return execute(context)
+ else:
+ print("Error: bpy.ops.console.execute_" + sc.language + " - not found")
+ return {'FINISHED'}
+
+
+class ConsoleAutocomplete(bpy.types.Operator):
+ '''Evaluate the namespace up until the cursor and give a list of options or complete the name if there is only one'''
+ bl_idname = "console.autocomplete"
+ bl_label = "Console Autocomplete"
+
+ def execute(self, context):
+ sc = context.space_data
+ module = __import__("console_" + sc.language)
+ autocomplete = getattr(module, "autocomplete", None)
+
+ if autocomplete:
+ return autocomplete(context)
+ else:
+ print("Error: bpy.ops.console.autocomplete_" + sc.language + " - not found")
+ return {'FINISHED'}
+
+
+class ConsoleBanner(bpy.types.Operator):
+ '''Print a message whem the terminal initializes'''
+ bl_idname = "console.banner"
+ bl_label = "Console Banner"
+
+ def execute(self, context):
+ sc = context.space_data
+
+ # default to python
+ if not sc.language:
+ sc.language = 'python'
+
+ module = __import__("console_" + sc.language)
+ banner = getattr(module, "banner", None)
+
+ if banner:
+ return banner(context)
+ else:
+ print("Error: bpy.ops.console.banner_" + sc.language + " - not found")
+ return {'FINISHED'}
+
+
+class ConsoleLanguage(bpy.types.Operator):
+ '''Set the current language for this console'''
+ bl_idname = "console.language"
+ bl_label = "Console Language"
+ language = StringProperty(name="Language", maxlen=32, default="")
+
+ def execute(self, context):
+ sc = context.space_data
+
+ # defailt to python
+ sc.language = self.language
+
+ bpy.ops.console.banner()
+
+ # insert a new blank line
+ bpy.ops.console.history_append(text="", current_character=0,
+ remove_duplicates=True)
+
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
new file mode 100644
index 00000000000..1ba9a628c1a
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -0,0 +1,362 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+#######################################
+# DopeSheet Filtering
+
+# used for DopeSheet, NLA, and Graph Editors
+def dopesheet_filter(layout, context, genericFiltersOnly=False):
+ dopesheet = context.space_data.dopesheet
+ is_nla = context.area.type == 'NLA_EDITOR'
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_only_selected", text="")
+ row.prop(dopesheet, "show_hidden", text="")
+
+ if genericFiltersOnly:
+ return
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_transforms", text="")
+
+ if is_nla:
+ row.prop(dopesheet, "show_missing_nla", text="")
+
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_scenes", text="")
+ row.prop(dopesheet, "show_worlds", text="")
+ row.prop(dopesheet, "show_nodes", text="")
+
+ if bpy.data.meshes:
+ row.prop(dopesheet, "show_meshes", text="")
+ if bpy.data.shape_keys:
+ row.prop(dopesheet, "show_shapekeys", text="")
+ if bpy.data.materials:
+ row.prop(dopesheet, "show_materials", text="")
+ if bpy.data.lamps:
+ row.prop(dopesheet, "show_lamps", text="")
+ if bpy.data.textures:
+ row.prop(dopesheet, "show_textures", text="")
+ if bpy.data.cameras:
+ row.prop(dopesheet, "show_cameras", text="")
+ if bpy.data.curves:
+ row.prop(dopesheet, "show_curves", text="")
+ if bpy.data.metaballs:
+ row.prop(dopesheet, "show_metaballs", text="")
+ if bpy.data.lattices:
+ row.prop(dopesheet, "show_lattices", text="")
+ if bpy.data.armatures:
+ row.prop(dopesheet, "show_armatures", text="")
+ if bpy.data.particles:
+ row.prop(dopesheet, "show_particles", text="")
+
+ if bpy.data.groups:
+ row = layout.row(align=True)
+ row.prop(dopesheet, "show_only_group_objects", text="")
+ if dopesheet.show_only_group_objects:
+ row.prop(dopesheet, "filter_group", text="")
+
+
+#######################################
+# DopeSheet Editor - General/Standard UI
+
+class DOPESHEET_HT_header(bpy.types.Header):
+ bl_space_type = 'DOPESHEET_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+
+ sub.menu("DOPESHEET_MT_view")
+ sub.menu("DOPESHEET_MT_select")
+ sub.menu("DOPESHEET_MT_marker")
+
+ if st.mode == 'DOPESHEET' or (st.mode == 'ACTION' and st.action != None):
+ sub.menu("DOPESHEET_MT_channel")
+ elif st.mode == 'GPENCIL':
+ sub.menu("DOPESHEET_MT_gpencil_channel")
+
+ if st.mode != 'GPENCIL':
+ sub.menu("DOPESHEET_MT_key")
+ else:
+ sub.menu("DOPESHEET_MT_gpencil_frame")
+
+ layout.prop(st, "mode", text="")
+ layout.prop(st.dopesheet, "show_summary", text="Summary")
+
+ if st.mode == 'DOPESHEET':
+ dopesheet_filter(layout, context)
+ elif st.mode == 'ACTION':
+ # 'genericFiltersOnly' limits the options to only the relevant 'generic' subset of
+ # filters which will work here and are useful (especially for character animation)
+ dopesheet_filter(layout, context, genericFiltersOnly=True)
+
+ if st.mode in {'ACTION', 'SHAPEKEY'}:
+ layout.template_ID(st, "action", new="action.new")
+
+ # Grease Pencil mode doesn't need snapping, as it's frame-aligned only
+ if st.mode != 'GPENCIL':
+ layout.prop(st, "auto_snap", text="")
+
+ row = layout.row(align=True)
+ row.operator("action.copy", text="", icon='COPYDOWN')
+ row.operator("action.paste", text="", icon='PASTEDOWN')
+
+
+class DOPESHEET_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.column()
+
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
+ layout.prop(st, "show_sliders")
+ layout.prop(st, "use_auto_merge_keyframes")
+ layout.prop(st, "use_marker_sync")
+
+ if st.show_seconds:
+ layout.operator("anim.time_toggle", text="Show Frames")
+ else:
+ layout.operator("anim.time_toggle", text="Show Seconds")
+
+ layout.separator()
+ layout.operator("anim.previewrange_set")
+ layout.operator("anim.previewrange_clear")
+ layout.operator("action.previewrange_set")
+
+ layout.separator()
+ layout.operator("action.frame_jump")
+ layout.operator("action.view_all")
+ layout.operator("action.view_selected")
+
+ layout.separator()
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class DOPESHEET_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
+ layout.operator("action.select_all_toggle")
+ layout.operator("action.select_all_toggle", text="Invert Selection").invert = True
+
+ layout.separator()
+ layout.operator("action.select_border")
+ layout.operator("action.select_border", text="Border Axis Range").axis_range = True
+
+ layout.separator()
+ layout.operator("action.select_column", text="Columns on Selected Keys").mode = 'KEYS'
+ layout.operator("action.select_column", text="Column on Current Frame").mode = 'CFRA'
+
+ layout.operator("action.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
+ layout.operator("action.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
+
+ layout.separator()
+ layout.operator("action.select_leftright", text="Before Current Frame").mode = 'LEFT'
+ layout.operator("action.select_leftright", text="After Current Frame").mode = 'RIGHT'
+
+ # FIXME: grease pencil mode isn't supported for these yet, so skip for that mode only
+ if context.space_data.mode != 'GPENCIL':
+ layout.separator()
+ layout.operator("action.select_more")
+ layout.operator("action.select_less")
+
+ layout.separator()
+ layout.operator("action.select_linked")
+
+
+class DOPESHEET_MT_marker(bpy.types.Menu):
+ bl_label = "Marker"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ #layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.column()
+ layout.operator("marker.add", "Add Marker")
+ layout.operator("marker.duplicate", text="Duplicate Marker")
+ layout.operator("marker.delete", text="Delete Marker")
+
+ layout.separator()
+
+ layout.operator("marker.rename", text="Rename Marker")
+ layout.operator("marker.move", text="Grab/Move Marker")
+
+ if st.mode in {'ACTION', 'SHAPEKEY'} and st.action:
+ layout.separator()
+ layout.prop(st, "show_pose_markers")
+
+ if st.show_pose_markers is False:
+ layout.operator("action.markers_make_local")
+
+
+#######################################
+# Keyframe Editing
+
+class DOPESHEET_MT_channel(bpy.types.Menu):
+ bl_label = "Channel"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_CHANNELS'
+
+ layout.column()
+ layout.operator("anim.channels_delete")
+
+ layout.separator()
+ layout.operator("anim.channels_setting_toggle")
+ layout.operator("anim.channels_setting_enable")
+ layout.operator("anim.channels_setting_disable")
+
+ layout.separator()
+ layout.operator("anim.channels_editable_toggle")
+ layout.operator_menu_enum("action.extrapolation_type", "type", text="Extrapolation Mode")
+
+ layout.separator()
+ layout.operator("anim.channels_expand")
+ layout.operator("anim.channels_collapse")
+
+ layout.separator()
+ layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
+
+ layout.separator()
+ layout.operator("anim.channels_fcurves_enable")
+
+
+class DOPESHEET_MT_key(bpy.types.Menu):
+ bl_label = "Key"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.menu("DOPESHEET_MT_key_transform", text="Transform")
+
+ layout.operator_menu_enum("action.snap", "type", text="Snap")
+ layout.operator_menu_enum("action.mirror", "type", text="Mirror")
+
+ layout.separator()
+ layout.operator("action.keyframe_insert")
+
+ layout.separator()
+ layout.operator("action.duplicate")
+ layout.operator("action.delete")
+
+ layout.separator()
+ layout.operator_menu_enum("action.keyframe_type", "type", text="Keyframe Type")
+ layout.operator_menu_enum("action.handle_type", "type", text="Handle Type")
+ layout.operator_menu_enum("action.interpolation_type", "type", text="Interpolation Mode")
+
+ layout.separator()
+ layout.operator("action.clean")
+ layout.operator("action.sample")
+
+ layout.separator()
+ layout.operator("action.copy")
+ layout.operator("action.paste")
+
+
+class DOPESHEET_MT_key_transform(bpy.types.Menu):
+ bl_label = "Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.operator("transform.transform", text="Grab/Move").mode = 'TIME_TRANSLATE'
+ layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
+ layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
+ layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
+
+
+#######################################
+# Grease Pencil Editing
+
+class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
+ bl_label = "Channel"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_CHANNELS'
+
+ layout.column()
+ layout.operator("anim.channels_delete")
+
+ layout.separator()
+ layout.operator("anim.channels_setting_toggle")
+ layout.operator("anim.channels_setting_enable")
+ layout.operator("anim.channels_setting_disable")
+
+ layout.separator()
+ layout.operator("anim.channels_editable_toggle")
+
+ # XXX: to be enabled when these are ready for use!
+ #layout.separator()
+ #layout.operator("anim.channels_expand")
+ #layout.operator("anim.channels_collapse")
+
+ #layout.separator()
+ #layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
+
+
+class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
+ bl_label = "Frame"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.menu("DOPESHEET_MT_key_transform", text="Transform")
+
+ #layout.operator_menu_enum("action.snap", "type", text="Snap")
+ #layout.operator_menu_enum("action.mirror", "type", text="Mirror")
+
+ layout.separator()
+ layout.operator("action.duplicate")
+ layout.operator("action.delete")
+
+ #layout.separator()
+ #layout.operator("action.copy")
+ #layout.operator("action.paste")
diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py
new file mode 100644
index 00000000000..3033ba10388
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_filebrowser.py
@@ -0,0 +1,74 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class FILEBROWSER_HT_header(bpy.types.Header):
+ bl_space_type = 'FILE_BROWSER'
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.template_header(menus=False)
+
+ row = layout.row()
+ row.separator()
+
+ row = layout.row(align=True)
+ row.operator("file.previous", text="", icon='BACK')
+ row.operator("file.next", text="", icon='FORWARD')
+ row.operator("file.parent", text="", icon='FILE_PARENT')
+ row.operator("file.refresh", text="", icon='FILE_REFRESH')
+
+ row = layout.row()
+ row.separator()
+
+ row = layout.row(align=True)
+ row.operator("file.directory_new", icon='NEWFOLDER')
+
+ params = st.params
+
+ # can be None when save/reload with a file selector open
+ if params:
+ layout.prop(params, "display_type", expand=True, text="")
+ layout.prop(params, "sort_method", expand=True, text="")
+
+ layout.prop(params, "show_hidden")
+ layout.prop(params, "use_filter", text="", icon='FILTER')
+
+ row = layout.row(align=True)
+ row.active = params.use_filter
+
+ row.prop(params, "use_filter_folder", text="")
+
+ if params.filter_glob:
+ #if st.operator and hasattr(st.operator, "filter_glob"):
+ # row.prop(params, "filter_glob", text="")
+ row.label(params.filter_glob)
+ else:
+ row.prop(params, "use_filter_blender", text="")
+ row.prop(params, "use_filter_image", text="")
+ row.prop(params, "use_filter_movie", text="")
+ row.prop(params, "use_filter_script", text="")
+ row.prop(params, "use_filter_font", text="")
+ row.prop(params, "use_filter_sound", text="")
+ row.prop(params, "use_filter_text", text="")
diff --git a/release/scripts/startup/bl_ui/space_graph.py b/release/scripts/startup/bl_ui/space_graph.py
new file mode 100644
index 00000000000..4e1b5aa9a6b
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_graph.py
@@ -0,0 +1,247 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+class GRAPH_HT_header(bpy.types.Header):
+ bl_space_type = 'GRAPH_EDITOR'
+
+ def draw(self, context):
+ from bl_ui.space_dopesheet import dopesheet_filter
+
+ layout = self.layout
+
+ st = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+
+ sub.menu("GRAPH_MT_view")
+ sub.menu("GRAPH_MT_select")
+ sub.menu("GRAPH_MT_marker")
+ sub.menu("GRAPH_MT_channel")
+ sub.menu("GRAPH_MT_key")
+
+ layout.prop(st, "mode", text="")
+
+ dopesheet_filter(layout, context)
+
+ layout.prop(st, "auto_snap", text="")
+ layout.prop(st, "pivot_point", text="", icon_only=True)
+
+ row = layout.row(align=True)
+ row.operator("graph.copy", text="", icon='COPYDOWN')
+ row.operator("graph.paste", text="", icon='PASTEDOWN')
+
+ row = layout.row(align=True)
+ if st.has_ghost_curves:
+ row.operator("graph.ghost_curves_clear", text="", icon='GHOST_DISABLED')
+ else:
+ row.operator("graph.ghost_curves_create", text="", icon='GHOST_ENABLED')
+
+
+class GRAPH_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.column()
+
+ layout.operator("graph.properties", icon='MENU_PANEL')
+ layout.separator()
+
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
+ layout.prop(st, "show_cursor")
+ layout.prop(st, "show_sliders")
+ layout.prop(st, "use_auto_merge_keyframes")
+
+ layout.separator()
+ layout.prop(st, "use_fancy_drawing")
+
+ layout.separator()
+ if st.show_handles:
+ layout.operator("graph.handles_view_toggle", icon='CHECKBOX_HLT', text="Show All Handles")
+ else:
+ layout.operator("graph.handles_view_toggle", icon='CHECKBOX_DEHLT', text="Show All Handles")
+ layout.prop(st, "use_only_selected_curves_handles")
+ layout.prop(st, "use_only_selected_keyframe_handles")
+ layout.operator("anim.time_toggle")
+
+ layout.separator()
+ layout.operator("anim.previewrange_set")
+ layout.operator("anim.previewrange_clear")
+ layout.operator("graph.previewrange_set")
+
+ layout.separator()
+ layout.operator("graph.frame_jump")
+ layout.operator("graph.view_all")
+ layout.operator("graph.view_selected")
+
+ layout.separator()
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class GRAPH_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
+ layout.operator("graph.select_all_toggle")
+ layout.operator("graph.select_all_toggle", text="Invert Selection").invert = True
+
+ layout.separator()
+ layout.operator("graph.select_border")
+ layout.operator("graph.select_border", text="Border Axis Range").axis_range = True
+ layout.operator("graph.select_border", text="Border (Include Handles)").include_handles = True
+
+ layout.separator()
+ layout.operator("graph.select_column", text="Columns on Selected Keys").mode = 'KEYS'
+ layout.operator("graph.select_column", text="Column on Current Frame").mode = 'CFRA'
+
+ layout.operator("graph.select_column", text="Columns on Selected Markers").mode = 'MARKERS_COLUMN'
+ layout.operator("graph.select_column", text="Between Selected Markers").mode = 'MARKERS_BETWEEN'
+
+ layout.separator()
+ layout.operator("graph.select_leftright", text="Before Current Frame").mode = 'LEFT'
+ layout.operator("graph.select_leftright", text="After Current Frame").mode = 'RIGHT'
+
+ layout.separator()
+ layout.operator("graph.select_more")
+ layout.operator("graph.select_less")
+
+ layout.separator()
+ layout.operator("graph.select_linked")
+
+
+class GRAPH_MT_marker(bpy.types.Menu):
+ bl_label = "Marker"
+
+ def draw(self, context):
+ layout = self.layout
+
+ #layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.column()
+ layout.operator("marker.add", "Add Marker")
+ layout.operator("marker.duplicate", text="Duplicate Marker")
+ layout.operator("marker.delete", text="Delete Marker")
+
+ layout.separator()
+
+ layout.operator("marker.rename", text="Rename Marker")
+ layout.operator("marker.move", text="Grab/Move Marker")
+
+ # TODO: pose markers for action edit mode only?
+
+
+class GRAPH_MT_channel(bpy.types.Menu):
+ bl_label = "Channel"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_CHANNELS'
+
+ layout.column()
+ layout.operator("anim.channels_delete")
+
+ layout.separator()
+ layout.operator("anim.channels_setting_toggle")
+ layout.operator("anim.channels_setting_enable")
+ layout.operator("anim.channels_setting_disable")
+
+ layout.separator()
+ layout.operator("anim.channels_editable_toggle")
+ layout.operator("anim.channels_visibility_set")
+ layout.operator_menu_enum("graph.extrapolation_type", "type", text="Extrapolation Mode")
+
+ layout.separator()
+ layout.operator("anim.channels_expand")
+ layout.operator("anim.channels_collapse")
+
+ layout.separator()
+ layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
+
+ layout.separator()
+ layout.operator("anim.channels_fcurves_enable")
+
+
+class GRAPH_MT_key(bpy.types.Menu):
+ bl_label = "Key"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.menu("GRAPH_MT_key_transform", text="Transform")
+
+ layout.operator_menu_enum("graph.snap", "type", text="Snap")
+ layout.operator_menu_enum("graph.mirror", "type", text="Mirror")
+
+ layout.separator()
+ layout.operator("graph.keyframe_insert")
+ layout.operator("graph.fmodifier_add")
+ layout.operator("graph.sound_bake")
+
+ layout.separator()
+ layout.operator("graph.duplicate")
+ layout.operator("graph.delete")
+
+ layout.separator()
+ layout.operator_menu_enum("graph.handle_type", "type", text="Handle Type")
+ layout.operator_menu_enum("graph.interpolation_type", "type", text="Interpolation Mode")
+
+ layout.separator()
+ layout.operator("graph.clean")
+ layout.operator("graph.smooth")
+ layout.operator("graph.sample")
+ layout.operator("graph.bake")
+
+ layout.separator()
+ layout.operator("graph.copy")
+ layout.operator("graph.paste")
+
+ layout.separator()
+ layout.operator("graph.euler_filter", text="Discontinuity (Euler) Filter")
+
+
+class GRAPH_MT_key_transform(bpy.types.Menu):
+ bl_label = "Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.operator("transform.translate", text="Grab/Move")
+ layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
+ layout.operator("transform.rotate", text="Rotate")
+ layout.operator("transform.resize", text="Scale")
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
new file mode 100644
index 00000000000..b2965d0c37a
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -0,0 +1,753 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class BrushButtonsPanel():
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ toolsettings = context.tool_settings.image_paint
+ return sima.show_paint and toolsettings.brush
+
+
+class IMAGE_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ uv = sima.uv_editor
+ toolsettings = context.tool_settings
+
+ show_uvedit = sima.show_uvedit
+
+ layout.operator("image.properties", icon='MENU_PANEL')
+ layout.operator("image.scopes", icon='MENU_PANEL')
+
+ layout.separator()
+
+ layout.prop(sima, "use_realtime_update")
+ if show_uvedit:
+ layout.prop(toolsettings, "show_uv_local_view")
+ layout.prop(uv, "show_other_objects")
+
+ layout.separator()
+
+ layout.operator("image.view_zoom_in")
+ layout.operator("image.view_zoom_out")
+
+ layout.separator()
+
+ ratios = [[1, 8], [1, 4], [1, 2], [1, 1], [2, 1], [4, 1], [8, 1]]
+
+ for a, b in ratios:
+ text = "Zoom %d:%d" % (a, b)
+ layout.operator("image.view_zoom_ratio", text=text).ratio = a / b
+
+ layout.separator()
+
+ if show_uvedit:
+ layout.operator("image.view_selected")
+
+ layout.operator("image.view_all")
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class IMAGE_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("uv.select_border")
+ layout.operator("uv.select_border").pinned = True
+
+ layout.separator()
+
+ layout.operator("uv.select_all")
+ layout.operator("uv.select_inverse")
+ layout.operator("uv.unlink_selection")
+
+ layout.separator()
+
+ layout.operator("uv.select_pinned")
+ layout.operator("uv.select_linked")
+
+
+class IMAGE_MT_image(bpy.types.Menu):
+ bl_label = "Image"
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+
+ layout.operator("image.new")
+ layout.operator("image.open")
+
+ show_render = sima.show_render
+
+ if ima:
+ if not show_render:
+ layout.operator("image.replace")
+ layout.operator("image.reload")
+
+ layout.operator("image.save")
+ layout.operator("image.save_as")
+ layout.operator("image.save_as", text="Save a Copy").copy = True
+
+ if ima.source == 'SEQUENCE':
+ layout.operator("image.save_sequence")
+
+ layout.operator("image.external_edit", "Edit Externally")
+
+ layout.separator()
+
+ layout.menu("IMAGE_MT_image_invert")
+
+ if not show_render:
+ layout.separator()
+
+ if ima.packed_file:
+ layout.operator("image.unpack")
+ else:
+ layout.operator("image.pack")
+
+ # only for dirty && specific image types, perhaps
+ # this could be done in operator poll too
+ if ima.is_dirty:
+ if ima.source in {'FILE', 'GENERATED'} and ima.type != 'MULTILAYER':
+ layout.operator("image.pack", text="Pack As PNG").as_png = True
+
+ layout.separator()
+
+ layout.prop(sima, "use_image_paint")
+
+
+class IMAGE_MT_image_invert(bpy.types.Menu):
+ bl_label = "Invert"
+
+ def draw(self, context):
+ layout = self.layout
+
+ op = layout.operator("image.invert", text="Invert Image Colors")
+ op.invert_r = True
+ op.invert_g = True
+ op.invert_b = True
+
+ layout.separator()
+
+ op = layout.operator("image.invert", text="Invert Red Channel")
+ op.invert_r = True
+
+ op = layout.operator("image.invert", text="Invert Green Channel")
+ op.invert_g = True
+
+ op = layout.operator("image.invert", text="Invert Blue Channel")
+ op.invert_b = True
+
+ op = layout.operator("image.invert", text="Invert Alpha Channel")
+ op.invert_a = True
+
+
+class IMAGE_MT_uvs_showhide(bpy.types.Menu):
+ bl_label = "Show/Hide Faces"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("uv.reveal")
+ layout.operator("uv.hide", text="Hide Selected")
+ layout.operator("uv.hide", text="Hide Unselected").unselected = True
+
+
+class IMAGE_MT_uvs_transform(bpy.types.Menu):
+ bl_label = "Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("transform.translate")
+ layout.operator("transform.rotate")
+ layout.operator("transform.resize")
+
+
+class IMAGE_MT_uvs_snap(bpy.types.Menu):
+ bl_label = "Snap"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.operator("uv.snap_selection", text="Selected to Pixels").target = 'PIXELS'
+ layout.operator("uv.snap_selection", text="Selected to Cursor").target = 'CURSOR'
+ layout.operator("uv.snap_selection", text="Selected to Adjacent Unselected").target = 'ADJACENT_UNSELECTED'
+
+ layout.separator()
+
+ layout.operator("uv.snap_cursor", text="Cursor to Pixels").target = 'PIXELS'
+ layout.operator("uv.snap_cursor", text="Cursor to Selection").target = 'SELECTION'
+
+
+class IMAGE_MT_uvs_mirror(bpy.types.Menu):
+ bl_label = "Mirror"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.operator("transform.mirror", text="X Axis").constraint_axis[0] = True
+ layout.operator("transform.mirror", text="Y Axis").constraint_axis[1] = True
+
+
+class IMAGE_MT_uvs_weldalign(bpy.types.Menu):
+ bl_label = "Weld/Align"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("uv.weld") # W, 1
+ layout.operator_enum("uv.align", "axis") # W, 2/3/4
+
+
+class IMAGE_MT_uvs(bpy.types.Menu):
+ bl_label = "UVs"
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ uv = sima.uv_editor
+ toolsettings = context.tool_settings
+
+ layout.prop(uv, "use_snap_to_pixels")
+ layout.prop(uv, "lock_bounds")
+
+ layout.separator()
+
+ layout.prop(uv, "use_live_unwrap")
+ layout.operator("uv.unwrap")
+ layout.operator("uv.pin", text="Unpin").clear = True
+ layout.operator("uv.pin")
+
+ layout.separator()
+
+ layout.operator("uv.pack_islands")
+ layout.operator("uv.average_islands_scale")
+ layout.operator("uv.minimize_stretch")
+ layout.operator("uv.stitch")
+ layout.operator("mesh.faces_miror_uv")
+
+ layout.separator()
+
+ layout.menu("IMAGE_MT_uvs_transform")
+ layout.menu("IMAGE_MT_uvs_mirror")
+ layout.menu("IMAGE_MT_uvs_snap")
+ layout.menu("IMAGE_MT_uvs_weldalign")
+
+ layout.separator()
+
+ layout.prop_menu_enum(toolsettings, "proportional_edit")
+ layout.prop_menu_enum(toolsettings, "proportional_edit_falloff")
+
+ layout.separator()
+
+ layout.menu("IMAGE_MT_uvs_showhide")
+
+
+class IMAGE_MT_uvs_select_mode(bpy.types.Menu):
+ bl_label = "UV Select Mode"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ toolsettings = context.tool_settings
+
+ # do smart things depending on whether uv_select_sync is on
+
+ if toolsettings.use_uv_select_sync:
+ prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
+ prop.value = "(True, False, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
+ prop.value = "(False, True, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
+ prop.value = "(False, False, True)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ else:
+ prop = layout.operator("wm.context_set_string", text="Vertex", icon='UV_VERTEXSEL')
+ prop.value = "VERTEX"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Edge", icon='UV_EDGESEL')
+ prop.value = "EDGE"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Face", icon='UV_FACESEL')
+ prop.value = "FACE"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+ prop = layout.operator("wm.context_set_string", text="Island", icon='UV_ISLANDSEL')
+ prop.value = "ISLAND"
+ prop.data_path = "tool_settings.uv_select_mode"
+
+
+class IMAGE_HT_header(bpy.types.Header):
+ bl_space_type = 'IMAGE_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+ iuser = sima.image_user
+ toolsettings = context.tool_settings
+
+ show_render = sima.show_render
+ # show_paint = sima.show_paint
+ show_uvedit = sima.show_uvedit
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ # menus
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("IMAGE_MT_view")
+
+ if show_uvedit:
+ sub.menu("IMAGE_MT_select")
+
+ if ima and ima.is_dirty:
+ sub.menu("IMAGE_MT_image", text="Image*")
+ else:
+ sub.menu("IMAGE_MT_image", text="Image")
+
+ if show_uvedit:
+ sub.menu("IMAGE_MT_uvs")
+
+ layout.template_ID(sima, "image", new="image.new")
+ if not show_render:
+ layout.prop(sima, "use_image_pin", text="")
+
+ # uv editing
+ if show_uvedit:
+ uvedit = sima.uv_editor
+
+ layout.prop(uvedit, "pivot_point", text="", icon_only=True)
+ layout.prop(toolsettings, "use_uv_select_sync", text="")
+
+ if toolsettings.use_uv_select_sync:
+ row = layout.row(align=True)
+ row.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
+ row.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
+ else:
+ layout.prop(toolsettings, "uv_select_mode", text="", expand=True)
+ layout.prop(uvedit, "sticky_select_mode", text="", icon_only=True)
+
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
+ if toolsettings.proportional_edit != 'DISABLED':
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
+
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_snap", text="")
+ row.prop(toolsettings, "snap_element", text="", icon_only=True)
+
+ mesh = context.edit_object.data
+ layout.prop_search(mesh.uv_textures, "active", mesh, "uv_textures", text="")
+
+ if ima:
+ # layers
+ layout.template_image_layers(ima, iuser)
+
+ # painting
+ layout.prop(sima, "use_image_paint", text="")
+
+ # draw options
+ row = layout.row(align=True)
+ row.prop(sima, "draw_channels", text="", expand=True)
+
+ row = layout.row(align=True)
+ if ima.type == 'COMPOSITE':
+ row.operator("image.record_composite", icon='REC')
+ if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}:
+ row.operator("image.play_composite", icon='PLAY')
+
+ if show_uvedit or sima.use_image_paint:
+ layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED')
+
+
+class IMAGE_PT_image_properties(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Image"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ iuser = sima.image_user
+
+ layout.template_image(sima, "image", iuser)
+
+
+class IMAGE_PT_game_properties(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Game Properties"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ sima = context.space_data
+ return (sima and sima.image) and (rd.engine == 'BLENDER_GAME')
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+
+ split = layout.split()
+
+ col = split.column()
+
+ sub = col.column(align=True)
+ sub.prop(ima, "use_animation")
+
+ subsub = sub.column()
+ subsub.active = ima.use_animation
+ subsub.prop(ima, "frame_start", text="Start")
+ subsub.prop(ima, "frame_end", text="End")
+ subsub.prop(ima, "fps", text="Speed")
+
+ col.prop(ima, "use_tiles")
+ sub = col.column(align=True)
+ sub.active = ima.use_tiles or ima.use_animation
+ sub.prop(ima, "tiles_x", text="X")
+ sub.prop(ima, "tiles_y", text="Y")
+
+ col = split.column()
+ col.label(text="Clamp:")
+ col.prop(ima, "use_clamp_x", text="X")
+ col.prop(ima, "use_clamp_y", text="Y")
+ col.separator()
+ col.prop(ima, "mapping", expand=True)
+
+
+class IMAGE_PT_view_histogram(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'PREVIEW'
+ bl_label = "Histogram"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+
+ layout.template_histogram(sima.scopes, "histogram")
+ layout.prop(sima.scopes.histogram, "mode", icon_only=True)
+
+
+class IMAGE_PT_view_waveform(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'PREVIEW'
+ bl_label = "Waveform"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ layout.template_waveform(sima, "scopes")
+ sub = layout.row().split(percentage=0.75)
+ sub.prop(sima.scopes, "waveform_alpha")
+ sub.prop(sima.scopes, "waveform_mode", text="", icon_only=True)
+
+
+class IMAGE_PT_view_vectorscope(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'PREVIEW'
+ bl_label = "Vectorscope"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ layout.template_vectorscope(sima, "scopes")
+ layout.prop(sima.scopes, "vectorscope_alpha")
+
+
+class IMAGE_PT_sample_line(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'PREVIEW'
+ bl_label = "Sample Line"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and sima.image)
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator("image.sample_line")
+ sima = context.space_data
+ layout.template_histogram(sima, "sample_histogram")
+ layout.prop(sima.sample_histogram, "mode")
+
+
+class IMAGE_PT_scope_sample(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'PREVIEW'
+ bl_label = "Scope Samples"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return sima
+
+ def draw(self, context):
+ layout = self.layout
+ sima = context.space_data
+ split = layout.split()
+ row = split.row()
+ row.prop(sima.scopes, "use_full_resolution")
+ row = split.row()
+ row.active = not sima.scopes.use_full_resolution
+ row.prop(sima.scopes, "accuracy")
+
+
+class IMAGE_PT_view_properties(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Display"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return (sima and (sima.image or sima.show_uvedit))
+
+ def draw(self, context):
+ layout = self.layout
+
+ sima = context.space_data
+ ima = sima.image
+ show_uvedit = sima.show_uvedit
+ uvedit = sima.uv_editor
+
+ split = layout.split()
+
+ col = split.column()
+ if ima:
+ col.prop(ima, "display_aspect", text="Aspect Ratio")
+
+ col = split.column()
+ col.label(text="Coordinates:")
+ col.prop(sima, "show_repeat", text="Repeat")
+ if show_uvedit:
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
+
+ elif show_uvedit:
+ col.label(text="Coordinates:")
+ col.prop(uvedit, "show_normalized_coords", text="Normalized")
+
+ if show_uvedit:
+
+ col = layout.column()
+ col.prop(uvedit, "cursor_location")
+
+ col = layout.column()
+ col.label(text="UVs:")
+ row = col.row()
+ row.prop(uvedit, "edge_draw_type", expand=True)
+
+ split = layout.split()
+ col = split.column()
+ col.prop(uvedit, "show_smooth_edges", text="Smooth")
+ col.prop(uvedit, "show_modified_edges", text="Modified")
+ #col.prop(uvedit, "show_edges")
+ #col.prop(uvedit, "show_faces")
+
+ col = split.column()
+ col.prop(uvedit, "show_stretch", text="Stretch")
+ sub = col.column()
+ sub.active = uvedit.show_stretch
+ sub.row().prop(uvedit, "draw_stretch_type", expand=True)
+
+
+class IMAGE_PT_paint(bpy.types.Panel):
+ bl_space_type = 'IMAGE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Paint"
+
+ @classmethod
+ def poll(cls, context):
+ sima = context.space_data
+ return sima.show_paint
+
+ def draw(self, context):
+ layout = self.layout
+
+ toolsettings = context.tool_settings.image_paint
+ brush = toolsettings.brush
+
+ col = layout.split().column()
+ row = col.row()
+ col.template_ID_preview(toolsettings, "brush", new="brush.add", rows=3, cols=8)
+
+ if brush:
+ col = layout.column()
+ col.template_color_wheel(brush, "color", value_slider=True)
+ col.prop(brush, "color", text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "size", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "jitter", slider=True)
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
+
+ col.prop(brush, "blend", text="Blend")
+
+ if brush.imagepaint_tool == 'CLONE':
+ col.separator()
+ col.prop(brush, "clone_image", text="Image")
+ col.prop(brush, "clone_alpha", text="Alpha")
+
+
+class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Texture"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ toolsettings = context.tool_settings.image_paint
+ brush = toolsettings.brush
+
+ col = layout.column()
+ col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+ col.prop(brush, "use_fixed_texture")
+
+
+class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Tool"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+ settings = context.tool_settings.image_paint
+ brush = settings.brush
+
+ col = layout.column(align=True)
+
+ col.prop(brush, "imagepaint_tool", expand=False, text="")
+
+ row = layout.row(align=True)
+ row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
+ row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
+ row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
+ row.prop(brush, "use_paint_texture", text="", icon='TPAINT_HLT')
+
+
+class IMAGE_PT_paint_stroke(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Paint Stroke"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ toolsettings = context.tool_settings.image_paint
+ brush = toolsettings.brush
+
+ layout.prop(brush, "use_airbrush")
+ col = layout.column()
+ col.active = brush.use_airbrush
+ col.prop(brush, "rate", slider=True)
+
+ layout.prop(brush, "use_space")
+ row = layout.row(align=True)
+ row.active = brush.use_space
+ row.prop(brush, "spacing", text="Distance", slider=True)
+ row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+
+ layout.prop(brush, "use_wrap")
+
+
+class IMAGE_PT_paint_curve(BrushButtonsPanel, bpy.types.Panel):
+ bl_label = "Paint Curve"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ toolsettings = context.tool_settings.image_paint
+ brush = toolsettings.brush
+
+ layout.template_curve_mapping(brush, "curve")
+
+ row = layout.row(align=True)
+ row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
+ row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
+ row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
+ row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
+ row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
+ row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
new file mode 100644
index 00000000000..be76cf7c4f8
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -0,0 +1,401 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class INFO_HT_header(bpy.types.Header):
+ bl_space_type = 'INFO'
+
+ def draw(self, context):
+ layout = self.layout
+
+ window = context.window
+ scene = context.scene
+ rd = scene.render
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("INFO_MT_file")
+ sub.menu("INFO_MT_add")
+ if rd.use_game_engine:
+ sub.menu("INFO_MT_game")
+ else:
+ sub.menu("INFO_MT_render")
+ sub.menu("INFO_MT_help")
+
+ if window.screen.show_fullscreen:
+ layout.operator("screen.back_to_previous", icon='SCREEN_BACK', text="Back to Previous")
+ layout.separator()
+ else:
+ layout.template_ID(context.window, "screen", new="screen.new", unlink="screen.delete")
+ layout.template_ID(context.screen, "scene", new="scene.new", unlink="scene.delete")
+
+ layout.separator()
+
+ if rd.has_multiple_engines:
+ layout.prop(rd, "engine", text="")
+
+ layout.separator()
+
+ layout.template_running_jobs()
+
+ layout.template_reports_banner()
+
+ layout.label(text=scene.statistics())
+
+ # XXX: this should be right-aligned to the RHS of the region
+ layout.operator("wm.window_fullscreen_toggle", icon='FULLSCREEN_ENTER', text="")
+
+ # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
+ """
+ sinfo = context.space_data
+ row = layout.row(align=True)
+ row.prop(sinfo, "show_report_debug", text="Debug")
+ row.prop(sinfo, "show_report_info", text="Info")
+ row.prop(sinfo, "show_report_operator", text="Operators")
+ row.prop(sinfo, "show_report_warning", text="Warnings")
+ row.prop(sinfo, "show_report_error", text="Errors")
+
+ row = layout.row()
+ row.enabled = sinfo.show_report_operator
+ row.operator("info.report_replay")
+
+ row.menu("INFO_MT_report")
+ """
+
+
+class INFO_MT_report(bpy.types.Menu):
+ bl_label = "Report"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.column()
+ layout.operator("console.select_all_toggle")
+ layout.operator("console.select_border")
+ layout.operator("console.report_delete")
+ layout.operator("console.report_copy")
+
+
+class INFO_MT_file(bpy.types.Menu):
+ bl_label = "File"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("wm.read_homefile", text="New", icon='NEW')
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
+ layout.menu("INFO_MT_file_open_recent")
+ layout.operator("wm.recover_last_session", icon='RECOVER_LAST')
+ layout.operator("wm.recover_auto_save", text="Recover Auto Save...")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.save_mainfile", text="Save", icon='FILE_TICK').check_existing = False
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.save_as_mainfile", text="Save As...")
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.save_as_mainfile", text="Save Copy...").copy = True
+
+ layout.separator()
+
+ layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES')
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("wm.save_homefile")
+ layout.operator("wm.read_factory_settings")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("wm.link_append", text="Link")
+ props = layout.operator("wm.link_append", text="Append")
+ props.link = False
+ props.instance_groups = False
+
+ layout.separator()
+
+ layout.menu("INFO_MT_file_import")
+ layout.menu("INFO_MT_file_export")
+
+ layout.separator()
+
+ layout.menu("INFO_MT_file_external_data")
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("wm.quit_blender", text="Quit", icon='QUIT')
+
+
+class INFO_MT_file_import(bpy.types.Menu):
+ bl_idname = "INFO_MT_file_import"
+ bl_label = "Import"
+
+ def draw(self, context):
+ if hasattr(bpy.types, "WM_OT_collada_import"):
+ self.layout.operator("wm.collada_import", text="COLLADA (.dae)")
+
+
+class INFO_MT_file_export(bpy.types.Menu):
+ bl_idname = "INFO_MT_file_export"
+ bl_label = "Export"
+
+ def draw(self, context):
+ if hasattr(bpy.types, "WM_OT_collada_export"):
+ self.layout.operator("wm.collada_export", text="COLLADA (.dae)")
+
+
+class INFO_MT_file_external_data(bpy.types.Menu):
+ bl_label = "External Data"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("file.pack_all", text="Pack into .blend file")
+ layout.operator("file.unpack_all", text="Unpack into Files")
+
+ layout.separator()
+
+ layout.operator("file.make_paths_relative")
+ layout.operator("file.make_paths_absolute")
+ layout.operator("file.report_missing_files")
+ layout.operator("file.find_missing_files")
+
+
+class INFO_MT_mesh_add(bpy.types.Menu):
+ bl_idname = "INFO_MT_mesh_add"
+ bl_label = "Mesh"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("mesh.primitive_plane_add", icon='MESH_PLANE', text="Plane")
+ layout.operator("mesh.primitive_cube_add", icon='MESH_CUBE', text="Cube")
+ layout.operator("mesh.primitive_circle_add", icon='MESH_CIRCLE', text="Circle")
+ layout.operator("mesh.primitive_uv_sphere_add", icon='MESH_UVSPHERE', text="UV Sphere")
+ layout.operator("mesh.primitive_ico_sphere_add", icon='MESH_ICOSPHERE', text="Icosphere")
+ layout.operator("mesh.primitive_cylinder_add", icon='MESH_CYLINDER', text="Cylinder")
+ layout.operator("mesh.primitive_cone_add", icon='MESH_CONE', text="Cone")
+ layout.separator()
+ layout.operator("mesh.primitive_grid_add", icon='MESH_GRID', text="Grid")
+ layout.operator("mesh.primitive_monkey_add", icon='MESH_MONKEY', text="Monkey")
+ layout.operator("mesh.primitive_torus_add", text="Torus", icon='MESH_TORUS')
+
+
+class INFO_MT_curve_add(bpy.types.Menu):
+ bl_idname = "INFO_MT_curve_add"
+ bl_label = "Curve"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("curve.primitive_bezier_curve_add", icon='CURVE_BEZCURVE', text="Bezier")
+ layout.operator("curve.primitive_bezier_circle_add", icon='CURVE_BEZCIRCLE', text="Circle")
+ layout.operator("curve.primitive_nurbs_curve_add", icon='CURVE_NCURVE', text="Nurbs Curve")
+ layout.operator("curve.primitive_nurbs_circle_add", icon='CURVE_NCIRCLE', text="Nurbs Circle")
+ layout.operator("curve.primitive_nurbs_path_add", icon='CURVE_PATH', text="Path")
+
+
+class INFO_MT_edit_curve_add(bpy.types.Menu):
+ bl_idname = "INFO_MT_edit_curve_add"
+ bl_label = "Add"
+
+ def draw(self, context):
+ is_surf = context.active_object.type == 'SURFACE'
+
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ if is_surf:
+ INFO_MT_surface_add.draw(self, context)
+ else:
+ INFO_MT_curve_add.draw(self, context)
+
+
+class INFO_MT_surface_add(bpy.types.Menu):
+ bl_idname = "INFO_MT_surface_add"
+ bl_label = "Surface"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("surface.primitive_nurbs_surface_curve_add", icon='SURFACE_NCURVE', text="NURBS Curve")
+ layout.operator("surface.primitive_nurbs_surface_circle_add", icon='SURFACE_NCIRCLE', text="NURBS Circle")
+ layout.operator("surface.primitive_nurbs_surface_surface_add", icon='SURFACE_NSURFACE', text="NURBS Surface")
+ layout.operator("surface.primitive_nurbs_surface_cylinder_add", icon='SURFACE_NCYLINDER', text="NURBS Cylinder")
+ layout.operator("surface.primitive_nurbs_surface_sphere_add", icon='SURFACE_NSPHERE', text="NURBS Sphere")
+ layout.operator("surface.primitive_nurbs_surface_torus_add", icon='SURFACE_NTORUS', text="NURBS Torus")
+
+
+class INFO_MT_armature_add(bpy.types.Menu):
+ bl_idname = "INFO_MT_armature_add"
+ bl_label = "Armature"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("object.armature_add", text="Single Bone", icon='BONE_DATA')
+
+
+class INFO_MT_add(bpy.types.Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'EXEC_SCREEN'
+
+ #layout.operator_menu_enum("object.mesh_add", "type", text="Mesh", icon='OUTLINER_OB_MESH')
+ layout.menu("INFO_MT_mesh_add", icon='OUTLINER_OB_MESH')
+
+ #layout.operator_menu_enum("object.curve_add", "type", text="Curve", icon='OUTLINER_OB_CURVE')
+ layout.menu("INFO_MT_curve_add", icon='OUTLINER_OB_CURVE')
+ #layout.operator_menu_enum("object.surface_add", "type", text="Surface", icon='OUTLINER_OB_SURFACE')
+ layout.menu("INFO_MT_surface_add", icon='OUTLINER_OB_SURFACE')
+ layout.operator_menu_enum("object.metaball_add", "type", text="Metaball", icon='OUTLINER_OB_META')
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("object.text_add", text="Text", icon='OUTLINER_OB_FONT')
+ layout.separator()
+
+ layout.menu("INFO_MT_armature_add", icon='OUTLINER_OB_ARMATURE')
+ layout.operator("object.add", text="Lattice", icon='OUTLINER_OB_LATTICE').type = 'LATTICE'
+ layout.operator("object.add", text="Empty", icon='OUTLINER_OB_EMPTY').type = 'EMPTY'
+ layout.separator()
+
+ layout.operator("object.camera_add", text="Camera", icon='OUTLINER_OB_CAMERA')
+ layout.operator_context = 'EXEC_SCREEN'
+ layout.operator_menu_enum("object.lamp_add", "type", text="Lamp", icon='OUTLINER_OB_LAMP')
+ layout.separator()
+
+ layout.operator_menu_enum("object.effector_add", "type", text="Force Field", icon='OUTLINER_OB_EMPTY')
+ layout.separator()
+
+ if(len(bpy.data.groups) > 10):
+ layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator("object.group_instance_add", text="Group Instance...", icon='OUTLINER_OB_EMPTY')
+ else:
+ layout.operator_menu_enum("object.group_instance_add", "group", text="Group Instance", icon='OUTLINER_OB_EMPTY')
+
+
+class INFO_MT_game(bpy.types.Menu):
+ bl_label = "Game"
+
+ def draw(self, context):
+ layout = self.layout
+
+ gs = context.scene.game_settings
+
+ layout.operator("view3d.game_start")
+
+ layout.separator()
+
+ layout.prop(gs, "show_debug_properties")
+ layout.prop(gs, "show_framerate_profile")
+ layout.prop(gs, "show_physics_visualization")
+ layout.prop(gs, "use_deprecation_warnings")
+ layout.prop(gs, "use_animation_record")
+ layout.separator()
+ layout.prop(gs, "use_auto_start")
+
+
+class INFO_MT_render(bpy.types.Menu):
+ bl_label = "Render"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("render.render", text="Render Image", icon='RENDER_STILL')
+ layout.operator("render.render", text="Render Animation", icon='RENDER_ANIMATION').animation = True
+
+ layout.separator()
+
+ layout.operator("render.opengl", text="OpenGL Render Image")
+ layout.operator("render.opengl", text="OpenGL Render Animation").animation = True
+
+ layout.separator()
+
+ layout.operator("render.view_show")
+ layout.operator("render.play_rendered_anim")
+
+
+class INFO_MT_help(bpy.types.Menu):
+ bl_label = "Help"
+
+ def draw(self, context):
+ import sys
+
+ layout = self.layout
+
+ layout.operator("wm.url_open", text="Manual", icon='HELP').url = 'http://wiki.blender.org/index.php/Doc:Manual'
+ layout.operator("wm.url_open", text="Release Log", icon='URL').url = 'http://www.blender.org/development/release-logs/blender-256-beta/'
+
+ layout.separator()
+
+ layout.operator("wm.url_open", text="Blender Website", icon='URL').url = 'http://www.blender.org/'
+ layout.operator("wm.url_open", text="Blender e-Shop", icon='URL').url = 'http://www.blender.org/e-shop'
+ layout.operator("wm.url_open", text="Developer Community", icon='URL').url = 'http://www.blender.org/community/get-involved/'
+ layout.operator("wm.url_open", text="User Community", icon='URL').url = 'http://www.blender.org/community/user-community/'
+ layout.separator()
+ layout.operator("wm.url_open", text="Report a Bug", icon='URL').url = 'http://projects.blender.org/tracker/?atid=498&group_id=9&func=browse'
+ layout.separator()
+ layout.operator("wm.url_open", text="Python API Reference", icon='URL').url = "http://www.blender.org/documentation/blender_python_api_%s/contents.html" % "_".join(str(v) for v in bpy.app.version)
+ layout.operator("help.operator_cheat_sheet", icon='TEXT')
+ layout.operator("wm.sysinfo", icon='TEXT')
+ layout.separator()
+ if sys.platform[:3] == "win":
+ layout.operator("wm.toggle_console", icon='CONSOLE')
+ layout.separator()
+ layout.operator("anim.update_data_paths", text="FCurve/Driver 2.54 fix", icon='HELP')
+ layout.separator()
+ layout.operator("wm.splash", icon='BLENDER')
+
+
+# Help operators
+
+
+class HELP_OT_operator_cheat_sheet(bpy.types.Operator):
+ bl_idname = "help.operator_cheat_sheet"
+ bl_label = "Operator Cheat Sheet"
+
+ def execute(self, context):
+ op_strings = []
+ tot = 0
+ for op_module_name in dir(bpy.ops):
+ op_module = getattr(bpy.ops, op_module_name)
+ for op_submodule_name in dir(op_module):
+ op = getattr(op_module, op_submodule_name)
+ text = repr(op)
+ if text.split("\n")[-1].startswith('bpy.ops.'):
+ op_strings.append(text)
+ tot += 1
+
+ op_strings.append('')
+
+ textblock = bpy.data.texts.new("OperatorList.txt")
+ textblock.write('# %d Operators\n\n' % tot)
+ textblock.write('\n'.join(op_strings))
+ self.report({'INFO'}, "See OperatorList.txt textblock")
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/space_logic.py b/release/scripts/startup/bl_ui/space_logic.py
new file mode 100644
index 00000000000..6eb33376fb7
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_logic.py
@@ -0,0 +1,87 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class LOGIC_PT_properties(bpy.types.Panel):
+ bl_space_type = 'LOGIC_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Properties"
+
+ @classmethod
+ def poll(cls, context):
+ ob = context.active_object
+ return ob and ob.game
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.active_object
+ game = ob.game
+
+ layout.operator("object.game_property_new", text="Add Game Property", icon='ZOOMIN')
+
+ for i, prop in enumerate(game.properties):
+
+ box = layout.box()
+ row = box.row()
+ row.prop(prop, "name", text="")
+ row.prop(prop, "type", text="")
+ row.prop(prop, "value", text="", toggle=True) # we dont care about the type. rna will display correctly
+ row.prop(prop, "show_debug", text="", toggle=True, icon='INFO')
+ row.operator("object.game_property_remove", text="", icon='X', emboss=False).index = i
+
+
+class LOGIC_MT_logicbricks_add(bpy.types.Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor")
+ layout.operator_menu_enum("logic.controller_add", "type", text="Controller")
+ layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator")
+
+
+class LOGIC_HT_header(bpy.types.Header):
+ bl_space_type = 'LOGIC_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("LOGIC_MT_view")
+ #sub.menu("LOGIC_MT_select")
+ #sub.menu("LOGIC_MT_add")
+
+
+class LOGIC_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+
+ layout.operator("logic.properties", icon='MENU_PANEL')
diff --git a/release/scripts/startup/bl_ui/space_nla.py b/release/scripts/startup/bl_ui/space_nla.py
new file mode 100644
index 00000000000..83d84647acb
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_nla.py
@@ -0,0 +1,191 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+
+
+class NLA_HT_header(bpy.types.Header):
+ bl_space_type = 'NLA_EDITOR'
+
+ def draw(self, context):
+ from space_dopesheet import dopesheet_filter
+
+ layout = self.layout
+
+ st = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+
+ sub.menu("NLA_MT_view")
+ sub.menu("NLA_MT_select")
+ sub.menu("NLA_MT_marker")
+ sub.menu("NLA_MT_edit")
+ sub.menu("NLA_MT_add")
+
+ dopesheet_filter(layout, context)
+
+ layout.prop(st, "auto_snap", text="")
+
+
+class NLA_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.column()
+
+ layout.operator("nla.properties", icon='MENU_PANEL')
+
+ layout.separator()
+
+ layout.prop(st, "use_realtime_update")
+ layout.prop(st, "show_frame_indicator")
+
+ layout.operator("anim.time_toggle", text="Show Frames" if st.show_seconds else "Show Seconds")
+
+ layout.prop(st, "show_strip_curves")
+
+ layout.separator()
+ layout.operator("anim.previewrange_set")
+ layout.operator("anim.previewrange_clear")
+
+ layout.separator()
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class NLA_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ # This is a bit misleading as the operator's default text is "Select All" while it actually *toggles* All/None
+ layout.operator("nla.select_all_toggle")
+ layout.operator("nla.select_all_toggle", text="Invert Selection").invert = True
+
+ layout.separator()
+ layout.operator("nla.select_border")
+ layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
+
+ layout.separator()
+ layout.operator("nla.select_leftright", text="Before Current Frame").mode = 'LEFT'
+ layout.operator("nla.select_leftright", text="After Current Frame").mode = 'RIGHT'
+
+
+class NLA_MT_marker(bpy.types.Menu):
+ bl_label = "Marker"
+
+ def draw(self, context):
+ layout = self.layout
+
+ #layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.column()
+ layout.operator("marker.add", "Add Marker")
+ layout.operator("marker.duplicate", text="Duplicate Marker")
+ layout.operator("marker.delete", text="Delete Marker")
+
+ layout.separator()
+
+ layout.operator("marker.rename", text="Rename Marker")
+ layout.operator("marker.move", text="Grab/Move Marker")
+
+
+class NLA_MT_edit(bpy.types.Menu):
+ bl_label = "Edit"
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+
+ layout.column()
+ layout.menu("NLA_MT_edit_transform", text="Transform")
+
+ layout.operator_menu_enum("nla.snap", "type", text="Snap")
+
+ layout.separator()
+ layout.operator("nla.duplicate")
+ layout.operator("nla.split")
+ layout.operator("nla.delete")
+
+ layout.separator()
+ layout.operator("nla.mute_toggle")
+
+ layout.separator()
+ layout.operator("nla.apply_scale")
+ layout.operator("nla.clear_scale")
+ layout.operator("nla.action_sync_length").active = False
+
+ layout.separator()
+ layout.operator("nla.swap")
+ layout.operator("nla.move_up")
+ layout.operator("nla.move_down")
+
+ # TODO: this really belongs more in a "channel" (or better, "track") menu
+ layout.separator()
+ layout.operator_menu_enum("anim.channels_move", "direction", text="Track Ordering...")
+
+ layout.separator()
+ # TODO: names of these tools for 'tweakmode' need changing?
+ if scene.is_nla_tweakmode:
+ layout.operator("nla.tweakmode_exit", text="Stop Tweaking Strip Actions")
+ else:
+ layout.operator("nla.tweakmode_enter", text="Start Tweaking Strip Actions")
+
+
+class NLA_MT_add(bpy.types.Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.operator("nla.actionclip_add")
+ layout.operator("nla.transition_add")
+
+ layout.separator()
+ layout.operator("nla.meta_add")
+ layout.operator("nla.meta_remove")
+
+ layout.separator()
+ layout.operator("nla.tracks_add")
+ layout.operator("nla.tracks_add", text="Add Tracks Above Selected").above_selected = True
+
+
+class NLA_MT_edit_transform(bpy.types.Menu):
+ bl_label = "Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.operator("transform.translate", text="Grab/Move")
+ layout.operator("transform.transform", text="Extend").mode = 'TIME_EXTEND'
+ layout.operator("transform.resize", text="Scale")
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
new file mode 100644
index 00000000000..7374b2ca260
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -0,0 +1,193 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class NODE_HT_header(bpy.types.Header):
+ bl_space_type = 'NODE_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ snode = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("NODE_MT_view")
+ sub.menu("NODE_MT_select")
+ sub.menu("NODE_MT_add")
+ sub.menu("NODE_MT_node")
+
+ row = layout.row()
+ row.prop(snode, "tree_type", text="", expand=True)
+
+ if snode.tree_type == 'MATERIAL':
+ ob = snode.id_from
+ snode_id = snode.id
+ if ob:
+ layout.template_ID(ob, "active_material", new="material.new")
+ if snode_id:
+ layout.prop(snode_id, "use_nodes")
+
+ elif snode.tree_type == 'TEXTURE':
+ row.prop(snode, "texture_type", text="", expand=True)
+
+ snode_id = snode.id
+ id_from = snode.id_from
+ if id_from:
+ if snode.texture_type == 'BRUSH':
+ layout.template_ID(id_from, "texture", new="texture.new")
+ else:
+ layout.template_ID(id_from, "active_texture", new="texture.new")
+ if snode_id:
+ layout.prop(snode_id, "use_nodes")
+
+ elif snode.tree_type == 'COMPOSITING':
+ scene = snode.id
+
+ layout.prop(scene, "use_nodes")
+ layout.prop(scene.render, "use_free_unused_nodes", text="Free Unused")
+ layout.prop(snode, "show_backdrop")
+ if snode.show_backdrop:
+ row = layout.row(align=True)
+ row.prop(snode, "backdrop_channels", text="", expand=True)
+ layout.prop(snode, "use_auto_render")
+
+ layout.separator()
+
+ layout.template_running_jobs()
+
+
+class NODE_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("node.properties", icon='MENU_PANEL')
+ layout.separator()
+
+ layout.operator("view2d.zoom_in")
+ layout.operator("view2d.zoom_out")
+
+ layout.separator()
+
+ layout.operator("node.view_all")
+
+ if context.space_data.show_backdrop:
+ layout.separator()
+
+ layout.operator("node.backimage_move", text="Backdrop move")
+ layout.operator("node.backimage_zoom", text="Backdrop zoom in").factor = 1.2
+ layout.operator("node.backimage_zoom", text="Backdrop zoom out").factor = 0.833
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class NODE_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("node.select_border")
+
+ layout.separator()
+ layout.operator("node.select_all")
+ layout.operator("node.select_linked_from")
+ layout.operator("node.select_linked_to")
+ layout.operator("node.select_same_type")
+ layout.operator("node.select_same_type_next")
+ layout.operator("node.select_same_type_prev")
+
+
+class NODE_MT_node(bpy.types.Menu):
+ bl_label = "Node"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("transform.translate")
+ layout.operator("transform.rotate")
+ layout.operator("transform.resize")
+
+ layout.separator()
+
+ layout.operator("node.duplicate_move")
+ layout.operator("node.delete")
+
+ layout.separator()
+ layout.operator("node.link_make")
+ layout.operator("node.link_make", text="Make and Replace Links").replace = True
+ layout.operator("node.links_cut")
+
+ layout.separator()
+ layout.operator("node.group_edit")
+ layout.operator("node.group_ungroup")
+ layout.operator("node.group_make")
+
+ layout.separator()
+
+ layout.operator("node.hide_toggle")
+ layout.operator("node.mute_toggle")
+ layout.operator("node.preview_toggle")
+ layout.operator("node.hide_socket_toggle")
+
+ layout.separator()
+
+ layout.operator("node.show_cyclic_dependencies")
+ layout.operator("node.read_renderlayers")
+ layout.operator("node.read_fullsamplelayers")
+
+
+# Node Backdrop options
+class NODE_PT_properties(bpy.types.Panel):
+ bl_space_type = 'NODE_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Backdrop"
+
+ @classmethod
+ def poll(cls, context):
+ snode = context.space_data
+ return snode.tree_type == 'COMPOSITING'
+
+ def draw_header(self, context):
+ snode = context.space_data
+ self.layout.prop(snode, "show_backdrop", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ snode = context.space_data
+ layout.active = snode.show_backdrop
+ layout.prop(snode, "backdrop_channels", text="")
+ layout.prop(snode, "backdrop_zoom", text="Zoom")
+
+ col = layout.column(align=True)
+ col.label(text="Offset:")
+ col.prop(snode, "backdrop_x", text="X")
+ col.prop(snode, "backdrop_y", text="Y")
+ col.operator("node.backimage_move", text="Move")
diff --git a/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
new file mode 100644
index 00000000000..aca213c77fe
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -0,0 +1,117 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class OUTLINER_HT_header(bpy.types.Header):
+ bl_space_type = 'OUTLINER'
+
+ def draw(self, context):
+ layout = self.layout
+
+ space = context.space_data
+ scene = context.scene
+ ks = context.scene.keying_sets.active
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("OUTLINER_MT_view")
+ sub.menu("OUTLINER_MT_search")
+ if space.display_mode == 'DATABLOCKS':
+ sub.menu("OUTLINER_MT_edit_datablocks")
+
+ layout.prop(space, "display_mode", text="")
+
+ layout.prop(space, "filter_text", icon='VIEWZOOM', text="")
+
+ layout.separator()
+
+ if space.display_mode == 'DATABLOCKS':
+ row = layout.row(align=True)
+ row.operator("outliner.keyingset_add_selected", icon='ZOOMIN', text="")
+ row.operator("outliner.keyingset_remove_selected", icon='ZOOMOUT', text="")
+
+ if ks:
+ row = layout.row(align=False)
+ row.prop_search(scene.keying_sets, "active", scene, "keying_sets", text="")
+
+ row = layout.row(align=True)
+ row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
+ row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
+ else:
+ row = layout.row(align=False)
+ row.label(text="No Keying Set active")
+
+
+class OUTLINER_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ space = context.space_data
+
+ col = layout.column()
+ if space.display_mode not in {'DATABLOCKS', 'USER_PREFERENCES', 'KEYMAPS'}:
+ col.prop(space, "show_restrict_columns")
+ col.separator()
+ col.operator("outliner.show_active")
+
+ col.operator("outliner.show_one_level")
+ col.operator("outliner.show_hierarchy")
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class OUTLINER_MT_search(bpy.types.Menu):
+ bl_label = "Search"
+
+ def draw(self, context):
+ layout = self.layout
+
+ space = context.space_data
+
+ col = layout.column()
+
+ col.prop(space, "use_filter_case_sensitive")
+ col.prop(space, "use_filter_complete")
+
+
+class OUTLINER_MT_edit_datablocks(bpy.types.Menu):
+ bl_label = "Edit"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column()
+
+ col.operator("outliner.keyingset_add_selected")
+ col.operator("outliner.keyingset_remove_selected")
+
+ col.separator()
+
+ col.operator("outliner.drivers_add_selected")
+ col.operator("outliner.drivers_delete_selected")
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
new file mode 100644
index 00000000000..77ac18e8600
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -0,0 +1,801 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+def act_strip(context):
+ try:
+ return context.scene.sequence_editor.active_strip
+ except AttributeError:
+ return None
+
+
+class SEQUENCER_HT_header(bpy.types.Header):
+ bl_space_type = 'SEQUENCE_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("SEQUENCER_MT_view")
+
+ if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
+ sub.menu("SEQUENCER_MT_select")
+ sub.menu("SEQUENCER_MT_marker")
+ sub.menu("SEQUENCER_MT_add")
+ sub.menu("SEQUENCER_MT_strip")
+
+ layout.prop(st, "view_type", expand=True, text="")
+
+ if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
+ layout.prop(st, "display_mode", expand=True, text="")
+
+ if (st.view_type == 'SEQUENCER'):
+ row = layout.row(align=True)
+ row.operator("sequencer.copy", text="", icon='COPYDOWN')
+ row.operator("sequencer.paste", text="", icon='PASTEDOWN')
+
+ layout.separator()
+ layout.operator("sequencer.refresh_all")
+ elif (st.view_type == 'SEQUENCER_PREVIEW'):
+ layout.separator()
+ layout.operator("sequencer.refresh_all")
+ layout.prop(st, "display_channel", text="Channel")
+ else:
+ layout.prop(st, "display_channel", text="Channel")
+
+ ed = context.scene.sequence_editor
+ if ed:
+ row = layout.row(align=True)
+ row.prop(ed, "show_overlay", text="", icon='GHOST_ENABLED')
+ if ed.show_overlay:
+ row.prop(ed, "overlay_frame", text="")
+ row.prop(ed, "overlay_lock", text="", icon='LOCKED')
+
+
+class SEQUENCER_MT_view_toggle(bpy.types.Menu):
+ bl_label = "View Type"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("sequencer.view_toggle").type = 'SEQUENCER'
+ layout.operator("sequencer.view_toggle").type = 'PREVIEW'
+ layout.operator("sequencer.view_toggle").type = 'SEQUENCER_PREVIEW'
+
+
+class SEQUENCER_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.column()
+
+ layout.operator("sequencer.properties", icon='MENU_PANEL')
+
+ layout.separator()
+
+ if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'):
+ layout.operator("sequencer.view_all", text='View all Sequences')
+ if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'):
+ layout.operator_context = 'INVOKE_REGION_PREVIEW'
+ layout.operator("sequencer.view_all_preview", text='Fit preview in window')
+ layout.operator("sequencer.view_zoom_ratio", text='Show preview 1:1').ratio = 1.0
+ layout.operator_context = 'INVOKE_DEFAULT'
+
+ # # XXX, invokes in the header view
+ # layout.operator("sequencer.view_ghost_border", text='Overlay Border')
+
+ layout.operator("sequencer.view_selected")
+
+ layout.prop(st, "show_frames")
+ layout.prop(st, "show_frame_indicator")
+ if st.display_mode == 'IMAGE':
+ layout.prop(st, "show_safe_margin")
+ if st.display_mode == 'WAVEFORM':
+ layout.prop(st, "show_separate_color")
+
+ layout.separator()
+ layout.prop(st, "use_marker_sync")
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+
+class SEQUENCER_MT_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.column()
+ layout.operator("sequencer.select_active_side", text="Strips to the Left").side = 'LEFT'
+ layout.operator("sequencer.select_active_side", text="Strips to the Right").side = 'RIGHT'
+ layout.separator()
+ layout.operator("sequencer.select_handles", text="Surrounding Handles").side = 'BOTH'
+ layout.operator("sequencer.select_handles", text="Left Handle").side = 'LEFT'
+ layout.operator("sequencer.select_handles", text="Right Handle").side = 'RIGHT'
+ layout.separator()
+ layout.operator("sequencer.select_linked")
+ layout.operator("sequencer.select_all_toggle")
+ layout.operator("sequencer.select_inverse")
+
+
+class SEQUENCER_MT_marker(bpy.types.Menu):
+ bl_label = "Marker"
+
+ def draw(self, context):
+ layout = self.layout
+
+ #layout.operator_context = 'EXEC_REGION_WIN'
+
+ layout.column()
+ layout.operator("marker.add", "Add Marker")
+ layout.operator("marker.duplicate", text="Duplicate Marker")
+ layout.operator("marker.delete", text="Delete Marker")
+
+ layout.separator()
+
+ layout.operator("marker.rename", text="Rename Marker")
+ layout.operator("marker.move", text="Grab/Move Marker")
+
+ #layout.operator("sequencer.sound_strip_add", text="Transform Markers") # toggle, will be rna - (sseq->flag & SEQ_MARKER_TRANS)
+
+
+class SEQUENCER_MT_add(bpy.types.Menu):
+ bl_label = "Add"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.column()
+ if len(bpy.data.scenes) > 10:
+ layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator("sequencer.scene_strip_add", text="Scene...")
+ else:
+ layout.operator_menu_enum("sequencer.scene_strip_add", "scene", text="Scene...")
+
+ layout.operator("sequencer.movie_strip_add", text="Movie")
+ layout.operator("sequencer.image_strip_add", text="Image")
+ layout.operator("sequencer.sound_strip_add", text="Sound")
+
+ layout.menu("SEQUENCER_MT_add_effect")
+
+
+class SEQUENCER_MT_add_effect(bpy.types.Menu):
+ bl_label = "Effect Strip..."
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.column()
+ layout.operator("sequencer.effect_strip_add", text="Add").type = 'ADD'
+ layout.operator("sequencer.effect_strip_add", text="Subtract").type = 'SUBTRACT'
+ layout.operator("sequencer.effect_strip_add", text="Alpha Over").type = 'ALPHA_OVER'
+ layout.operator("sequencer.effect_strip_add", text="Alpha Under").type = 'ALPHA_UNDER'
+ layout.operator("sequencer.effect_strip_add", text="Cross").type = 'CROSS'
+ layout.operator("sequencer.effect_strip_add", text="Gamma Cross").type = 'GAMMA_CROSS'
+ layout.operator("sequencer.effect_strip_add", text="Multiply").type = 'MULTIPLY'
+ layout.operator("sequencer.effect_strip_add", text="Over Drop").type = 'OVER_DROP'
+ layout.operator("sequencer.effect_strip_add", text="Plugin").type = 'PLUGIN'
+ layout.operator("sequencer.effect_strip_add", text="Wipe").type = 'WIPE'
+ layout.operator("sequencer.effect_strip_add", text="Glow").type = 'GLOW'
+ layout.operator("sequencer.effect_strip_add", text="Transform").type = 'TRANSFORM'
+ layout.operator("sequencer.effect_strip_add", text="Color").type = 'COLOR'
+ layout.operator("sequencer.effect_strip_add", text="Speed Control").type = 'SPEED'
+ layout.operator("sequencer.effect_strip_add", text="Multicam Selector").type = 'MULTICAM'
+
+
+class SEQUENCER_MT_strip(bpy.types.Menu):
+ bl_label = "Strip"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.column()
+ layout.operator("transform.transform", text="Grab/Move").mode = 'TRANSLATION'
+ layout.operator("transform.transform", text="Grab/Extend from frame").mode = 'TIME_EXTEND'
+ # uiItemO(layout, NULL, 0, "sequencer.strip_snap"); // TODO - add this operator
+ layout.separator()
+
+ layout.operator("sequencer.cut", text="Cut (hard) at frame").type = 'HARD'
+ layout.operator("sequencer.cut", text="Cut (soft) at frame").type = 'SOFT'
+ layout.operator("sequencer.images_separate")
+ layout.operator("sequencer.deinterlace_selected_movies")
+ layout.separator()
+
+ layout.operator("sequencer.duplicate")
+ layout.operator("sequencer.delete")
+
+ strip = act_strip(context)
+
+ if strip:
+ stype = strip.type
+
+ # XXX note strip.type is never equal to 'EFFECT', look at seq_type_items within rna_sequencer.c
+ if stype == 'EFFECT':
+ pass
+ # layout.separator()
+ # layout.operator("sequencer.effect_change")
+ # layout.operator("sequencer.effect_reassign_inputs")
+ elif stype == 'IMAGE':
+ layout.separator()
+ # layout.operator("sequencer.image_change")
+ layout.operator("sequencer.rendersize")
+ elif stype == 'SCENE':
+ pass
+ # layout.separator()
+ # layout.operator("sequencer.scene_change", text="Change Scene")
+ elif stype == 'MOVIE':
+ layout.separator()
+ # layout.operator("sequencer.movie_change")
+ layout.operator("sequencer.rendersize")
+
+ layout.separator()
+
+ layout.operator("sequencer.meta_make")
+ layout.operator("sequencer.meta_separate")
+
+ #if (ed && (ed->metastack.first || (ed->act_seq && ed->act_seq->type == SEQ_META))) {
+ # uiItemS(layout);
+ # uiItemO(layout, NULL, 0, "sequencer.meta_toggle");
+ #}
+
+ layout.separator()
+ layout.operator("sequencer.reload")
+ layout.operator("sequencer.reassign_inputs")
+ layout.operator("sequencer.swap_inputs")
+ layout.separator()
+ layout.operator("sequencer.lock")
+ layout.operator("sequencer.unlock")
+ layout.operator("sequencer.mute")
+ layout.operator("sequencer.unmute")
+
+ layout.operator("sequencer.mute", text="Mute Deselected Strips").unselected = True
+
+ layout.operator("sequencer.snap")
+
+ layout.operator_menu_enum("sequencer.swap", "side")
+
+ layout.separator()
+
+ layout.operator("sequencer.swap_data")
+
+
+class SequencerButtonsPanel():
+ bl_space_type = 'SEQUENCE_EDITOR'
+ bl_region_type = 'UI'
+
+ @staticmethod
+ def has_sequencer(context):
+ return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
+
+ @classmethod
+ def poll(cls, context):
+ return cls.has_sequencer(context) and (act_strip(context) is not None)
+
+
+class SequencerButtonsPanel_Output():
+ bl_space_type = 'SEQUENCE_EDITOR'
+ bl_region_type = 'UI'
+
+ @staticmethod
+ def has_preview(context):
+ return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
+
+ @classmethod
+ def poll(cls, context):
+ return cls.has_preview(context)
+
+
+class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Edit Strip"
+
+ def draw(self, context):
+ layout = self.layout
+ scene = context.scene
+ frame_current = scene.frame_current
+ strip = act_strip(context)
+
+ split = layout.split(percentage=0.3)
+ split.label(text="Name:")
+ split.prop(strip, "name", text="")
+
+ split = layout.split(percentage=0.3)
+ split.label(text="Type:")
+ split.prop(strip, "type", text="")
+
+ split = layout.split(percentage=0.3)
+ split.label(text="Blend:")
+ split.prop(strip, "blend_type", text="")
+
+ row = layout.row(align=True)
+ sub = row.row()
+ sub.active = (not strip.mute)
+ sub.prop(strip, "blend_alpha", text="Opacity", slider=True)
+ row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="")
+ row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="")
+
+ col = layout.column()
+ sub = col.column()
+ sub.enabled = not strip.lock
+ sub.prop(strip, "channel")
+ sub.prop(strip, "frame_start")
+ sub.prop(strip, "frame_final_duration")
+
+ col = layout.column(align=True)
+ row = col.row()
+ row.label(text="Final Length: %s" % bpy.utils.smpte_from_frame(strip.frame_final_duration))
+ row = col.row()
+ row.active = (frame_current >= strip.frame_start and frame_current <= strip.frame_start + strip.frame_duration)
+ row.label(text="Playhead: %d" % (frame_current - strip.frame_start))
+
+ col.label(text="Frame Offset %d:%d" % (strip.frame_offset_start, strip.frame_offset_end))
+ col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end))
+
+ elem = False
+
+ if strip.type == 'IMAGE':
+ elem = strip.getStripElem(frame_current)
+ elif strip.type == 'MOVIE':
+ elem = strip.elements[0]
+
+ if elem and elem.orig_width > 0 and elem.orig_height > 0:
+ col.label(text="Orig Dim: %dx%d" % (elem.orig_width, elem.orig_height))
+
+
+class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Effect Strip"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return strip.type in {'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+ 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
+ 'PLUGIN',
+ 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR', 'SPEED',
+ 'MULTICAM'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+ if strip.input_count > 0:
+ col = layout.column()
+ col.prop(strip, "input_1")
+ if strip.input_count > 1:
+ col.prop(strip, "input_2")
+ if strip.input_count > 2:
+ col.prop(strip, "input_3")
+
+ if strip.type == 'COLOR':
+ layout.prop(strip, "color")
+
+ elif strip.type == 'WIPE':
+
+ col = layout.column()
+ col.prop(strip, "transition_type")
+ col.label(text="Direction:")
+ col.row().prop(strip, "direction", expand=True)
+
+ col = layout.column()
+ col.prop(strip, "blur_width", slider=True)
+ if strip.transition_type in {'SINGLE', 'DOUBLE'}:
+ col.prop(strip, "angle")
+
+ elif strip.type == 'GLOW':
+ flow = layout.column_flow()
+ flow.prop(strip, "threshold", slider=True)
+ flow.prop(strip, "clamp", slider=True)
+ flow.prop(strip, "boost_factor")
+ flow.prop(strip, "blur_radius")
+
+ row = layout.row()
+ row.prop(strip, "quality", slider=True)
+ row.prop(strip, "use_only_boost")
+
+ elif strip.type == 'SPEED':
+ layout.prop(strip, "use_default_fade", "Stretch to input strip length")
+ if not strip.use_default_fade:
+ layout.prop(strip, "use_as_speed")
+ if strip.use_as_speed:
+ layout.prop(strip, "speed_factor")
+ else:
+ layout.prop(strip, "speed_factor", text="Frame number")
+ layout.prop(strip, "scale_to_length")
+
+ #doesn't work currently
+ #layout.prop(strip, "use_frame_blend")
+
+ elif strip.type == 'TRANSFORM':
+ self.draw_panel_transform(strip)
+
+ elif strip.type == "MULTICAM":
+ layout.prop(strip, "multicam_source")
+
+ row = layout.row(align=True)
+ sub = row.row()
+ sub.scale_x = 2.0
+
+ sub.operator("screen.animation_play", text="", icon='PAUSE' if context.screen.is_animation_playing else 'PLAY')
+
+ row.label("Cut To")
+ for i in range(1, strip.channel):
+ row.operator("sequencer.cut_multicam", text=str(i)).camera = i
+
+ col = layout.column(align=True)
+ if strip.type == 'SPEED':
+ col.prop(strip, "multiply_speed")
+ elif strip.type in {'CROSS', 'GAMMA_CROSS', 'PLUGIN', 'WIPE'}:
+ col.prop(strip, "use_default_fade", "Default fade")
+ if not strip.use_default_fade:
+ col.prop(strip, "effect_fader", text="Effect fader")
+
+ layout.prop(strip, "use_translation", text="Image Offset:")
+ if strip.use_translation:
+ col = layout.column(align=True)
+ col.prop(strip.transform, "offset_x", text="X")
+ col.prop(strip.transform, "offset_y", text="Y")
+
+ layout.prop(strip, "use_crop", text="Image Crop:")
+ if strip.use_crop:
+ col = layout.column(align=True)
+ col.prop(strip.crop, "max_y")
+ col.prop(strip.crop, "min_x")
+ col.prop(strip.crop, "min_y")
+ col.prop(strip.crop, "max_x")
+
+ def draw_panel_transform(self, strip):
+ layout = self.layout
+ col = layout.column()
+
+ col.prop(strip, "interpolation")
+ col.prop(strip, "translation_unit")
+ col = layout.column(align=True)
+ col.label(text="Position:")
+ col.prop(strip, "translate_start_x", text="X")
+ col.prop(strip, "translate_start_y", text="Y")
+
+ layout.separator()
+
+ col = layout.column(align=True)
+ col.prop(strip, "use_uniform_scale")
+ if (strip.use_uniform_scale):
+ col = layout.column(align=True)
+ col.prop(strip, "scale_start_x", text="Scale")
+ else:
+ col = layout.column(align=True)
+ col.label(text="Scale:")
+ col.prop(strip, "scale_start_x", text="X")
+ col.prop(strip, "scale_start_y", text="Y")
+
+ layout.separator()
+
+ col = layout.column(align=True)
+ col.label(text="Rotation:")
+ col.prop(strip, "rotation_start", text="Rotation")
+
+
+class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Strip Input"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
+ 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+ 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
+ 'PLUGIN',
+ 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
+ 'MULTICAM', 'SPEED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+
+ seq_type = strip.type
+
+ # draw a filename if we have one
+ if seq_type == 'IMAGE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "directory", text="")
+
+ # Current element for the filename
+
+ elem = strip.getStripElem(context.scene.frame_current)
+ if elem:
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="File:")
+ col = split.column()
+ col.prop(elem, "filename", text="") # strip.elements[0] could be a fallback
+
+ elif seq_type == 'MOVIE':
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.label(text="Path:")
+ col = split.column()
+ col.prop(strip, "filepath", text="")
+ col.prop(strip, "mpeg_preseek", text="MPEG Preseek")
+
+ # TODO, sound???
+ # end drawing filename
+
+ layout.prop(strip, "use_translation", text="Image Offset:")
+ if strip.use_translation:
+ col = layout.column(align=True)
+ col.prop(strip.transform, "offset_x", text="X")
+ col.prop(strip.transform, "offset_y", text="Y")
+
+ layout.prop(strip, "use_crop", text="Image Crop:")
+ if strip.use_crop:
+ col = layout.column(align=True)
+ col.prop(strip.crop, "max_y")
+ col.prop(strip.crop, "min_x")
+ col.prop(strip.crop, "min_y")
+ col.prop(strip.crop, "max_x")
+
+ if not isinstance(strip, bpy.types.EffectSequence):
+ col = layout.column(align=True)
+ col.label(text="Trim Duration (hard):")
+ col.prop(strip, "animation_offset_start", text="Start")
+ col.prop(strip, "animation_offset_end", text="End")
+
+ col = layout.column(align=True)
+ col.label(text="Trim Duration (soft):")
+ col.prop(strip, "frame_offset_start", text="Start")
+ col.prop(strip, "frame_offset_end", text="End")
+
+
+class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Sound"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return (strip.type == 'SOUND')
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+
+ layout.template_ID(strip, "sound", open="sound.open")
+
+ layout.separator()
+ layout.prop(strip, "filepath", text="")
+
+ row = layout.row()
+ if strip.sound.packed_file:
+ row.operator("sound.unpack", icon='PACKAGE', text="Unpack")
+ else:
+ row.operator("sound.pack", icon='UGLYPACKAGE', text="Pack")
+
+ row.prop(strip.sound, "use_memory_cache")
+
+ layout.prop(strip, "volume")
+ layout.prop(strip, "attenuation")
+
+ col = layout.column(align=True)
+ col.label(text="Trim Duration:")
+ col.prop(strip, "animation_offset_start", text="Start")
+ col.prop(strip, "animation_offset_end", text="End")
+
+
+class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Scene"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return (strip.type == 'SCENE')
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+
+ layout.template_ID(strip, "scene")
+
+ layout.label(text="Camera Override")
+ layout.template_ID(strip, "scene_camera")
+
+ sce = strip.scene
+ layout.label(text="Original frame range: %d-%d (%d)" % (sce.frame_start, sce.frame_end, sce.frame_end - sce.frame_start + 1))
+
+
+class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Filter"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META',
+ 'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
+ 'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
+ 'PLUGIN',
+ 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
+ 'MULTICAM', 'SPEED'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+
+ col = layout.column()
+ col.label(text="Video:")
+ col.prop(strip, "strobe")
+
+ row = layout.row()
+ row.label(text="Flip:")
+ row.prop(strip, "use_flip_x", text="X")
+ row.prop(strip, "use_flip_y", text="Y")
+
+ col = layout.column()
+ col.prop(strip, "use_reverse_frames", text="Backwards")
+ col.prop(strip, "use_deinterlace")
+
+ col = layout.column()
+ col.label(text="Colors:")
+ col.prop(strip, "color_saturation", text="Saturation")
+ col.prop(strip, "color_multiply", text="Multiply")
+ col.prop(strip, "use_premultiply")
+ col.prop(strip, "use_float")
+
+ layout.prop(strip, "use_color_balance")
+ if strip.use_color_balance and strip.color_balance: # TODO - need to add this somehow
+ row = layout.row()
+ row.active = strip.use_color_balance
+ col = row.column()
+ col.template_color_wheel(strip.color_balance, "lift", value_slider=False, cubic=True)
+ col.row().prop(strip.color_balance, "lift")
+ col.prop(strip.color_balance, "invert_lift", text="Inverse")
+ col = row.column()
+ col.template_color_wheel(strip.color_balance, "gamma", value_slider=False, lock_luminosity=True, cubic=True)
+ col.row().prop(strip.color_balance, "gamma")
+ col.prop(strip.color_balance, "invert_gamma", text="Inverse")
+ col = row.column()
+ col.template_color_wheel(strip.color_balance, "gain", value_slider=False, lock_luminosity=True, cubic=True)
+ col.row().prop(strip.color_balance, "gain")
+ col.prop(strip.color_balance, "invert_gain", text="Inverse")
+
+
+class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
+ bl_label = "Proxy"
+
+ @classmethod
+ def poll(cls, context):
+ if not cls.has_sequencer(context):
+ return False
+
+ strip = act_strip(context)
+ if not strip:
+ return False
+
+ return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'META', 'MULTICAM'}
+
+ def draw_header(self, context):
+ strip = act_strip(context)
+
+ self.layout.prop(strip, "use_proxy", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ strip = act_strip(context)
+
+ flow = layout.column_flow()
+ flow.prop(strip, "use_proxy_custom_directory")
+ flow.prop(strip, "use_proxy_custom_file")
+ if strip.proxy: # TODO - need to add this somehow
+ if strip.use_proxy_custom_directory and not strip.use_proxy_custom_file:
+ flow.prop(strip.proxy, "directory")
+ if strip.use_proxy_custom_file:
+ flow.prop(strip.proxy, "filepath")
+
+
+class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, bpy.types.Panel):
+ bl_label = "Scene Preview/Render"
+ bl_space_type = 'SEQUENCE_EDITOR'
+ bl_region_type = 'UI'
+
+ def draw(self, context):
+ layout = self.layout
+ render = context.scene.render
+
+ col = layout.column()
+ col.active = False # Currently only opengl preview works!
+ col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview")
+ col = layout.column()
+ #col.active = render.use_sequencer_gl_preview
+ col.prop(render, "sequencer_gl_preview", text="")
+
+ '''
+ col = layout.column()
+ col.prop(render, "use_sequencer_gl_render", text="Open GL Render")
+ col = layout.column()
+ col.active = render.use_sequencer_gl_render
+ col.prop(render, "sequencer_gl_render", text="")
+ '''
+
+
+class SEQUENCER_PT_view(SequencerButtonsPanel_Output, bpy.types.Panel):
+ bl_label = "View Settings"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ col = layout.column()
+ if st.display_mode == 'IMAGE':
+ col.prop(st, "draw_overexposed") # text="Zebra"
+ col.prop(st, "show_safe_margin")
+ if st.display_mode == 'WAVEFORM':
+ col.prop(st, "show_separate_color")
+ col.prop(st, "proxy_render_size")
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py
new file mode 100644
index 00000000000..d21d6952023
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_text.py
@@ -0,0 +1,299 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class TEXT_HT_header(bpy.types.Header):
+ bl_space_type = 'TEXT_EDITOR'
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+ text = st.text
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("TEXT_MT_view")
+ sub.menu("TEXT_MT_text")
+ if text:
+ sub.menu("TEXT_MT_edit")
+ sub.menu("TEXT_MT_format")
+
+ if text and text.is_modified:
+ row = layout.row()
+ # row.color(redalert)
+ row.operator("text.resolve_conflict", text="", icon='HELP')
+
+ layout.template_ID(st, "text", new="text.new", unlink="text.unlink")
+
+ row = layout.row(align=True)
+ row.prop(st, "show_line_numbers", text="")
+ row.prop(st, "show_word_wrap", text="")
+ row.prop(st, "show_syntax_highlight", text="")
+
+ if text:
+ row = layout.row()
+ row.operator("text.run_script")
+
+ row = layout.row()
+ row.active = text.name.endswith(".py")
+ row.prop(text, "use_module")
+
+ row = layout.row()
+ if text.filepath:
+ if text.is_dirty:
+ row.label(text="File: *%s (unsaved)" % text.filepath)
+ else:
+ row.label(text="File: %s" % text.filepath)
+ else:
+ row.label(text="Text: External" if text.library else "Text: Internal")
+
+
+class TEXT_PT_properties(bpy.types.Panel):
+ bl_space_type = 'TEXT_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Properties"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ flow = layout.column_flow()
+ flow.prop(st, "show_line_numbers")
+ flow.prop(st, "show_word_wrap")
+ flow.prop(st, "show_syntax_highlight")
+ flow.prop(st, "show_line_highlight")
+ flow.prop(st, "use_live_edit")
+
+ flow = layout.column_flow()
+ flow.prop(st, "font_size")
+ flow.prop(st, "tab_width")
+
+ text = st.text
+ if text:
+ flow.prop(text, "use_tabs_as_spaces")
+
+ flow.prop(st, "show_margin")
+ col = flow.column()
+ col.active = st.show_margin
+ col.prop(st, "margin_column")
+
+
+class TEXT_PT_find(bpy.types.Panel):
+ bl_space_type = 'TEXT_EDITOR'
+ bl_region_type = 'UI'
+ bl_label = "Find"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ # find
+ col = layout.column(align=True)
+ row = col.row()
+ row.prop(st, "find_text", text="")
+ row.operator("text.find_set_selected", text="", icon='TEXT')
+ col.operator("text.find")
+
+ # replace
+ col = layout.column(align=True)
+ row = col.row()
+ row.prop(st, "replace_text", text="")
+ row.operator("text.replace_set_selected", text="", icon='TEXT')
+ col.operator("text.replace")
+
+ # mark
+ layout.operator("text.mark_all")
+
+ # settings
+ row = layout.row()
+ row.prop(st, "use_find_wrap", text="Wrap")
+ row.prop(st, "use_find_all", text="All")
+
+
+class TEXT_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.properties", icon='MENU_PANEL')
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.screen_full_area")
+
+ layout.separator()
+
+ layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
+ layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
+
+
+class TEXT_MT_text(bpy.types.Menu):
+ bl_label = "Text"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+ text = st.text
+
+ layout.column()
+ layout.operator("text.new")
+ layout.operator("text.open")
+
+ if text:
+ layout.operator("text.reload")
+
+ layout.column()
+ layout.operator("text.save")
+ layout.operator("text.save_as")
+
+ if text.filepath:
+ layout.operator("text.make_internal")
+
+ layout.column()
+ layout.operator("text.run_script")
+
+ #ifdef WITH_PYTHON
+ # XXX if(BPY_is_pyconstraint(text))
+ # XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
+ #endif
+
+ layout.separator()
+
+ layout.menu("TEXT_MT_templates")
+
+
+class TEXT_MT_templates(bpy.types.Menu):
+ '''
+ Creates the menu items by scanning scripts/templates
+ '''
+ bl_label = "Script Templates"
+
+ def draw(self, context):
+ self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
+
+
+class TEXT_MT_edit_select(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.select_all")
+ layout.operator("text.select_line")
+
+
+class TEXT_MT_edit_markers(bpy.types.Menu):
+ bl_label = "Markers"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.markers_clear")
+ layout.operator("text.next_marker")
+ layout.operator("text.previous_marker")
+
+
+class TEXT_MT_format(bpy.types.Menu):
+ bl_label = "Format"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.indent")
+ layout.operator("text.unindent")
+
+ layout.separator()
+
+ layout.operator("text.comment")
+ layout.operator("text.uncomment")
+
+ layout.separator()
+
+ layout.operator_menu_enum("text.convert_whitespace", "type")
+
+
+class TEXT_MT_edit_to3d(bpy.types.Menu):
+ bl_label = "Text To 3D Object"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("text.to_3d_object", text="One Object").split_lines = False
+ layout.operator("text.to_3d_object", text="One Object Per Line").split_lines = True
+
+
+class TEXT_MT_edit(bpy.types.Menu):
+ bl_label = "Edit"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.space_data.text)
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.operator("text.cut")
+ layout.operator("text.copy")
+ layout.operator("text.paste")
+
+ layout.separator()
+
+ layout.menu("TEXT_MT_edit_select")
+ layout.menu("TEXT_MT_edit_markers")
+
+ layout.separator()
+
+ layout.operator("text.jump")
+ layout.operator("text.properties", text="Find...")
+
+ layout.separator()
+
+ layout.menu("TEXT_MT_edit_to3d")
+
+
+class TEXT_MT_toolbox(bpy.types.Menu):
+ bl_label = ""
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_DEFAULT'
+
+ layout.operator("text.cut")
+ layout.operator("text.copy")
+ layout.operator("text.paste")
+
+ layout.separator()
+
+ layout.operator("text.run_script")
diff --git a/release/scripts/startup/bl_ui/space_time.py b/release/scripts/startup/bl_ui/space_time.py
new file mode 100644
index 00000000000..f3c2bed5a1d
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_time.py
@@ -0,0 +1,198 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class TIME_HT_header(bpy.types.Header):
+ bl_space_type = 'TIMELINE'
+
+ def draw(self, context):
+ layout = self.layout
+
+ scene = context.scene
+ tools = context.tool_settings
+ screen = context.screen
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ if context.area.show_menus:
+ sub = row.row(align=True)
+ sub.menu("TIME_MT_view")
+ sub.menu("TIME_MT_frame")
+ sub.menu("TIME_MT_playback")
+
+ layout.prop(scene, "use_preview_range", text="", toggle=True)
+
+ row = layout.row(align=True)
+ if not scene.use_preview_range:
+ row.prop(scene, "frame_start", text="Start")
+ row.prop(scene, "frame_end", text="End")
+ else:
+ row.prop(scene, "frame_preview_start", text="Start")
+ row.prop(scene, "frame_preview_end", text="End")
+
+ layout.prop(scene, "frame_current", text="")
+
+ layout.separator()
+
+ row = layout.row(align=True)
+ row.operator("screen.frame_jump", text="", icon='REW').end = False
+ row.operator("screen.keyframe_jump", text="", icon='PREV_KEYFRAME').next = False
+ if not screen.is_animation_playing:
+ # if using JACK and A/V sync:
+ # hide the play-reversed button
+ # since JACK transport doesn't support reversed playback
+ if (context.user_preferences.system.audio_device == 'JACK' and scene.sync_mode == 'AUDIO_SYNC'):
+ sub = row.row()
+ sub.scale_x = 2.0
+ sub.operator("screen.animation_play", text="", icon='PLAY')
+ else:
+ row.operator("screen.animation_play", text="", icon='PLAY_REVERSE').reverse = True
+ row.operator("screen.animation_play", text="", icon='PLAY')
+ else:
+ sub = row.row()
+ sub.scale_x = 2.0
+ sub.operator("screen.animation_play", text="", icon='PAUSE')
+ row.operator("screen.keyframe_jump", text="", icon='NEXT_KEYFRAME').next = True
+ row.operator("screen.frame_jump", text="", icon='FF').end = True
+
+ layout.prop(scene, "sync_mode", text="")
+
+ layout.separator()
+
+ row = layout.row(align=True)
+ row.prop(tools, "use_keyframe_insert_auto", text="", toggle=True)
+ row.prop(tools, "use_keyframe_insert_keyingset", text="", toggle=True)
+ if screen.is_animation_playing and tools.use_keyframe_insert_auto:
+ subsub = row.row()
+ subsub.prop(tools, "use_record_with_nla", toggle=True)
+
+ row = layout.row(align=True)
+ row.prop_search(scene.keying_sets_all, "active", scene, "keying_sets_all", text="")
+ row.operator("anim.keyframe_insert", text="", icon='KEY_HLT')
+ row.operator("anim.keyframe_delete", text="", icon='KEY_DEHLT')
+
+
+class TIME_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.operator("anim.time_toggle")
+ layout.operator("time.view_all")
+
+ layout.separator()
+
+ layout.prop(st, "show_frame_indicator")
+ layout.prop(st, "show_only_selected")
+
+ layout.separator()
+
+ layout.menu("TIME_MT_cache")
+
+ layout.separator()
+
+ layout.operator("marker.camera_bind")
+
+
+class TIME_MT_cache(bpy.types.Menu):
+ bl_label = "Cache"
+
+ def draw(self, context):
+ layout = self.layout
+
+ st = context.space_data
+
+ layout.prop(st, "show_cache")
+
+ layout.separator()
+
+ col = layout.column()
+ col.enabled = st.show_cache
+ col.prop(st, "cache_softbody")
+ col.prop(st, "cache_particles")
+ col.prop(st, "cache_cloth")
+ col.prop(st, "cache_smoke")
+
+
+class TIME_MT_frame(bpy.types.Menu):
+ bl_label = "Frame"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("marker.add", text="Add Marker")
+ layout.operator("marker.duplicate", text="Duplicate Marker")
+ layout.operator("marker.delete", text="Delete Marker")
+
+ layout.separator()
+
+ layout.operator("marker.rename", text="Rename Marker")
+ layout.operator("marker.move", text="Grab/Move Marker")
+
+ layout.separator()
+
+ layout.operator("time.start_frame_set")
+ layout.operator("time.end_frame_set")
+
+ layout.separator()
+
+ sub = layout.row()
+ sub.menu("TIME_MT_autokey")
+
+
+class TIME_MT_playback(bpy.types.Menu):
+ bl_label = "Playback"
+
+ def draw(self, context):
+ layout = self.layout
+
+ screen = context.screen
+ scene = context.scene
+
+ layout.prop(screen, "use_play_top_left_3d_editor")
+ layout.prop(screen, "use_play_3d_editors")
+ layout.prop(screen, "use_play_animation_editors")
+ layout.prop(screen, "use_play_properties_editors")
+ layout.prop(screen, "use_play_image_editors")
+ layout.prop(screen, "use_play_sequence_editors")
+ layout.prop(screen, "use_play_node_editors")
+
+ layout.separator()
+
+ layout.prop(scene, "use_frame_drop", text="Frame Dropping")
+ layout.prop(scene, "use_audio_sync", text="AV-sync", icon='SPEAKER')
+ layout.prop(scene, "use_audio")
+ layout.prop(scene, "use_audio_scrub")
+
+
+class TIME_MT_autokey(bpy.types.Menu):
+ bl_label = "Auto-Keyframing Mode"
+
+ def draw(self, context):
+ layout = self.layout
+ tools = context.tool_settings
+
+ layout.prop_enum(tools, "auto_keying_mode", 'ADD_REPLACE_KEYS')
+ layout.prop_enum(tools, "auto_keying_mode", 'REPLACE_KEYS')
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
new file mode 100644
index 00000000000..c79caf78b4b
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -0,0 +1,1172 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+import os
+import addon_utils
+
+from bpy.props import StringProperty, BoolProperty, EnumProperty
+
+
+def ui_items_general(col, context):
+ """ General UI Theme Settings (User Interface)
+ """
+
+ row = col.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(context, "outline")
+ colsub.row().prop(context, "item", slider=True)
+ colsub.row().prop(context, "inner", slider=True)
+ colsub.row().prop(context, "inner_sel", slider=True)
+
+ subsplit = row.split(percentage=0.85)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(context, "text")
+ colsub.row().prop(context, "text_sel")
+ colsub.prop(context, "show_shaded")
+ subsub = colsub.column(align=True)
+ subsub.active = context.show_shaded
+ subsub.prop(context, "shadetop")
+ subsub.prop(context, "shadedown")
+
+ col.separator()
+
+
+def opengl_lamp_buttons(column, lamp):
+ split = column.split(percentage=0.1)
+
+ split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')
+
+ col = split.column()
+ col.active = lamp.use
+ row = col.row()
+ row.label(text="Diffuse:")
+ row.prop(lamp, "diffuse_color", text="")
+ row = col.row()
+ row.label(text="Specular:")
+ row.prop(lamp, "specular_color", text="")
+
+ col = split.column()
+ col.active = lamp.use
+ col.prop(lamp, "direction", text="")
+
+
+class USERPREF_HT_header(bpy.types.Header):
+ bl_space_type = 'USER_PREFERENCES'
+
+ def draw(self, context):
+ layout = self.layout
+ layout.template_header(menus=False)
+
+ userpref = context.user_preferences
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("wm.save_homefile", text="Save As Default")
+
+ layout.operator_context = 'INVOKE_DEFAULT'
+
+ if userpref.active_section == 'INPUT':
+ layout.operator("wm.keyconfig_export")
+ layout.operator("wm.keyconfig_import")
+ elif userpref.active_section == 'ADDONS':
+ layout.operator("wm.addon_install")
+ layout.menu("USERPREF_MT_addons_dev_guides", text=" Addons Developer Guides", icon='INFO')
+ elif userpref.active_section == 'THEMES':
+ layout.operator("ui.reset_default_theme")
+
+
+class USERPREF_PT_tabs(bpy.types.Panel):
+ bl_label = ""
+ bl_space_type = 'USER_PREFERENCES'
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+
+ layout.prop(userpref, "active_section", expand=True)
+
+
+class USERPREF_MT_interaction_presets(bpy.types.Menu):
+ bl_label = "Presets"
+ preset_subdir = "interaction"
+ preset_operator = "script.execute_preset"
+ draw = bpy.types.Menu.draw_preset
+
+
+class USERPREF_MT_splash(bpy.types.Menu):
+ bl_label = "Splash"
+
+ def draw(self, context):
+ layout = self.layout
+ split = layout.split()
+ row = split.row()
+ row.label("")
+ row = split.row()
+ row.label("Interaction:")
+ # XXX, no redraws
+ # text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
+ # if not text:
+ # text = "Blender (default)"
+ row.menu("USERPREF_MT_keyconfigs", text="Preset")
+
+
+class USERPREF_PT_interface(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Interface"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'INTERFACE')
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+ view = userpref.view
+
+ row = layout.row()
+
+ col = row.column()
+ col.label(text="Display:")
+ col.prop(view, "show_tooltips")
+ col.prop(view, "show_tooltips_python")
+ col.prop(view, "show_object_info", text="Object Info")
+ col.prop(view, "show_large_cursors")
+ col.prop(view, "show_view_name", text="View Name")
+ col.prop(view, "show_playback_fps", text="Playback FPS")
+ col.prop(view, "use_global_scene")
+ col.prop(view, "object_origin_size")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.prop(view, "show_mini_axis", text="Display Mini Axis")
+ sub = col.column()
+ sub.active = view.show_mini_axis
+ sub.prop(view, "mini_axis_size", text="Size")
+ sub.prop(view, "mini_axis_brightness", text="Brightness")
+
+ col.separator()
+ row.separator()
+ row.separator()
+
+ col = row.column()
+ col.label(text="View Manipulation:")
+ col.prop(view, "use_mouse_auto_depth")
+ col.prop(view, "use_zoom_to_mouse")
+ col.prop(view, "use_rotate_around_active")
+ col.prop(view, "use_global_pivot")
+
+ col.separator()
+
+ col.prop(view, "use_auto_perspective")
+ col.prop(view, "smooth_view")
+ col.prop(view, "rotation_angle")
+
+ col.separator()
+ col.separator()
+
+ col.label(text="2D Viewports:")
+ col.prop(view, "view2d_grid_spacing_min", text="Minimum Grid Spacing")
+ col.prop(view, "timecode_style")
+
+ row.separator()
+ row.separator()
+
+ col = row.column()
+ #Toolbox doesn't exist yet
+ #col.label(text="Toolbox:")
+ #col.prop(view, "show_column_layout")
+ #col.label(text="Open Toolbox Delay:")
+ #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
+ #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
+ col.prop(view, "show_manipulator")
+ sub = col.column()
+ sub.active = view.show_manipulator
+ sub.prop(view, "manipulator_size", text="Size")
+ sub.prop(view, "manipulator_handle_size", text="Handle Size")
+ sub.prop(view, "manipulator_hotspot", text="Hotspot")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Menus:")
+ col.prop(view, "use_mouse_over_open")
+ col.label(text="Menu Open Delay:")
+ col.prop(view, "open_toplevel_delay", text="Top Level")
+ col.prop(view, "open_sublevel_delay", text="Sub Level")
+
+ col.separator()
+
+ col.prop(view, "show_splash")
+
+
+class USERPREF_PT_edit(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Edit"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'EDITING')
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+ edit = userpref.edit
+
+ row = layout.row()
+
+ col = row.column()
+ col.label(text="Link Materials To:")
+ col.prop(edit, "material_link", text="")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="New Objects:")
+ col.prop(edit, "use_enter_edit_mode")
+ col.label(text="Align To:")
+ col.prop(edit, "object_align", text="")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Undo:")
+ col.prop(edit, "use_global_undo")
+ col.prop(edit, "undo_steps", text="Steps")
+ col.prop(edit, "undo_memory_limit", text="Memory Limit")
+
+ row.separator()
+ row.separator()
+
+ col = row.column()
+ col.label(text="Grease Pencil:")
+ col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
+ col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
+ #col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
+ col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
+ col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
+ col.separator()
+ col.separator()
+ col.separator()
+ col.label(text="Playback:")
+ col.prop(edit, "use_negative_frames")
+
+ row.separator()
+ row.separator()
+
+ col = row.column()
+ col.label(text="Keyframing:")
+ col.prop(edit, "use_visual_keying")
+ col.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed")
+
+ col.separator()
+
+ col.prop(edit, "use_auto_keying", text="Auto Keyframing:")
+
+ sub = col.column()
+
+ # sub.active = edit.use_keyframe_insert_auto # incorrect, timeline can enable
+ sub.prop(edit, "use_keyframe_insert_available", text="Only Insert Available")
+
+ col.separator()
+
+ col.label(text="New F-Curve Defaults:")
+ col.prop(edit, "keyframe_new_interpolation_type", text="Interpolation")
+ col.prop(edit, "keyframe_new_handle_type", text="Handles")
+ col.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Transform:")
+ col.prop(edit, "use_drag_immediately")
+
+ row.separator()
+ row.separator()
+
+ col = row.column()
+ col.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Duplicate Data:")
+ col.prop(edit, "use_duplicate_mesh", text="Mesh")
+ col.prop(edit, "use_duplicate_surface", text="Surface")
+ col.prop(edit, "use_duplicate_curve", text="Curve")
+ col.prop(edit, "use_duplicate_text", text="Text")
+ col.prop(edit, "use_duplicate_metaball", text="Metaball")
+ col.prop(edit, "use_duplicate_armature", text="Armature")
+ col.prop(edit, "use_duplicate_lamp", text="Lamp")
+ col.prop(edit, "use_duplicate_material", text="Material")
+ col.prop(edit, "use_duplicate_texture", text="Texture")
+ #col.prop(edit, "use_duplicate_fcurve", text="F-Curve")
+ col.prop(edit, "use_duplicate_action", text="Action")
+ col.prop(edit, "use_duplicate_particle", text="Particle")
+
+
+class USERPREF_PT_system(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "System"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'SYSTEM')
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+ system = userpref.system
+
+ split = layout.split()
+
+ # 1. Column
+ column = split.column()
+ colsplit = column.split(percentage=0.85)
+
+ col = colsplit.column()
+ col.label(text="General:")
+ col.prop(system, "dpi")
+ col.prop(system, "frame_server_port")
+ col.prop(system, "scrollback", text="Console Scrollback")
+ col.prop(system, "author", text="Author")
+ col.prop(system, "use_scripts_auto_execute")
+ col.prop(system, "use_tabs_as_spaces")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Sound:")
+ col.row().prop(system, "audio_device", expand=True)
+ sub = col.column()
+ sub.active = system.audio_device != 'NONE'
+ #sub.prop(system, "use_preview_images")
+ sub.prop(system, "audio_channels", text="Channels")
+ sub.prop(system, "audio_mixing_buffer", text="Mixing Buffer")
+ sub.prop(system, "audio_sample_rate", text="Sample Rate")
+ sub.prop(system, "audio_sample_format", text="Sample Format")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Screencast:")
+ col.prop(system, "screencast_fps")
+ col.prop(system, "screencast_wait_time")
+ col.separator()
+ col.separator()
+ col.separator()
+
+ #column = split.column()
+ #colsplit = column.split(percentage=0.85)
+
+ # No translation in 2.5 yet
+ #col.prop(system, "language")
+ #col.label(text="Translate:")
+ #col.prop(system, "use_translate_tooltips", text="Tooltips")
+ #col.prop(system, "use_translate_buttons", text="Labels")
+ #col.prop(system, "use_translate_toolbox", text="Toolbox")
+
+ #col.separator()
+
+ #col.prop(system, "use_textured_fonts")
+
+ # 2. Column
+ column = split.column()
+ colsplit = column.split(percentage=0.85)
+
+ col = colsplit.column()
+ col.label(text="OpenGL:")
+ col.prop(system, "gl_clip_alpha", slider=True)
+ col.prop(system, "use_mipmaps")
+ col.prop(system, "use_vertex_buffer_objects")
+ #Anti-aliasing is disabled as it breaks broder/lasso select
+ #col.prop(system, "use_antialiasing")
+ col.label(text="Window Draw Method:")
+ col.prop(system, "window_draw_method", text="")
+ col.label(text="Text Draw Options:")
+ col.prop(system, "use_text_antialiasing")
+ col.label(text="Textures:")
+ col.prop(system, "gl_texture_limit", text="Limit Size")
+ col.prop(system, "texture_time_out", text="Time Out")
+ col.prop(system, "texture_collection_rate", text="Collection Rate")
+
+ col.separator()
+ col.separator()
+ col.separator()
+
+ col.label(text="Sequencer:")
+ col.prop(system, "prefetch_frames")
+ col.prop(system, "memory_cache_limit")
+
+ # 3. Column
+ column = split.column()
+
+ column.label(text="Solid OpenGL lights:")
+
+ split = column.split(percentage=0.1)
+ split.label()
+ split.label(text="Colors:")
+ split.label(text="Direction:")
+
+ lamp = system.solid_lights[0]
+ opengl_lamp_buttons(column, lamp)
+
+ lamp = system.solid_lights[1]
+ opengl_lamp_buttons(column, lamp)
+
+ lamp = system.solid_lights[2]
+ opengl_lamp_buttons(column, lamp)
+
+ column.separator()
+ column.separator()
+ column.separator()
+
+ column.label(text="Color Picker Type:")
+ column.row().prop(system, "color_picker_type", text="")
+
+ column.separator()
+ column.separator()
+ column.separator()
+
+ column.prop(system, "use_weight_color_range", text="Custom Weight Paint Range")
+ sub = column.column()
+ sub.active = system.use_weight_color_range
+ sub.template_color_ramp(system, "weight_color_range", expand=True)
+
+
+class USERPREF_PT_theme(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Themes"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ @staticmethod
+ def _theme_generic(split, themedata):
+
+ row = split.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding1 = subsplit.split(percentage=0.15)
+ padding1.column()
+
+ subsplit = row.split(percentage=0.85)
+
+ padding2 = subsplit.split(percentage=0.15)
+ padding2.column()
+
+ colsub_pair = padding1.column(), padding2.column()
+
+ props_type = {}
+
+ for i, prop in enumerate(themedata.rna_type.properties):
+ attr = prop.identifier
+ if attr == "rna_type":
+ continue
+
+ props_type.setdefault((prop.type, prop.subtype), []).append(prop.identifier)
+
+ for props_type, props_ls in sorted(props_type.items()):
+ for i, attr in enumerate(props_ls):
+ colsub_pair[i % 2].row().prop(themedata, attr)
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'THEMES')
+
+ def draw(self, context):
+ layout = self.layout
+
+ theme = context.user_preferences.themes[0]
+
+ split_themes = layout.split(percentage=0.2)
+ split_themes.prop(theme, "theme_area", expand=True)
+
+ split = layout.split(percentage=0.4)
+
+ layout.separator()
+ layout.separator()
+
+ split = split_themes.split()
+
+ if theme.theme_area == 'USER_INTERFACE':
+ col = split.column()
+
+ ui = theme.user_interface.wcol_regular
+ col.label(text="Regular:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_tool
+ col.label(text="Tool:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_radio
+ col.label(text="Radio Buttons:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_text
+ col.label(text="Text:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_option
+ col.label(text="Option:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_toggle
+ col.label(text="Toggle:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_num
+ col.label(text="Number Field:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_numslider
+ col.label(text="Value Slider:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_box
+ col.label(text="Box:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_menu
+ col.label(text="Menu:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_pulldown
+ col.label(text="Pulldown:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_menu_back
+ col.label(text="Menu Back:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_menu_item
+ col.label(text="Menu Item:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_scroll
+ col.label(text="Scroll Bar:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_progress
+ col.label(text="Progress Bar:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_list_item
+ col.label(text="List Item:")
+ ui_items_general(col, ui)
+
+ ui = theme.user_interface.wcol_state
+ col.label(text="State:")
+
+ row = col.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "inner_anim")
+ colsub.row().prop(ui, "inner_anim_sel")
+ colsub.row().prop(ui, "inner_driven")
+ colsub.row().prop(ui, "inner_driven_sel")
+
+ subsplit = row.split(percentage=0.85)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "inner_key")
+ colsub.row().prop(ui, "inner_key_sel")
+ colsub.row().prop(ui, "blend")
+
+ ui = theme.user_interface
+ col.separator()
+ col.separator()
+
+ split = col.split(percentage=0.93)
+ split.prop(ui, "icon_file")
+
+ layout.separator()
+ layout.separator()
+ elif theme.theme_area == 'COLOR_SETS':
+ col = split.column()
+
+ for i, ui in enumerate(theme.bone_color_sets):
+ col.label(text="Color Set %d:" % (i + 1)) # i starts from 0
+
+ row = col.row()
+
+ subsplit = row.split(percentage=0.95)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "normal")
+ colsub.row().prop(ui, "select")
+ colsub.row().prop(ui, "active")
+
+ subsplit = row.split(percentage=0.85)
+
+ padding = subsplit.split(percentage=0.15)
+ colsub = padding.column()
+ colsub = padding.column()
+ colsub.row().prop(ui, "show_colored_constraints")
+ else:
+ self._theme_generic(split, getattr(theme, theme.theme_area.lower()))
+
+
+class USERPREF_PT_file(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Files"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'FILES')
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+ paths = userpref.filepaths
+
+ split = layout.split(percentage=0.7)
+
+ col = split.column()
+ col.label(text="File Paths:")
+
+ colsplit = col.split(percentage=0.95)
+ col1 = colsplit.split(percentage=0.3)
+
+ sub = col1.column()
+ sub.label(text="Fonts:")
+ sub.label(text="Textures:")
+ sub.label(text="Texture Plugins:")
+ sub.label(text="Sequence Plugins:")
+ sub.label(text="Render Output:")
+ sub.label(text="Scripts:")
+ sub.label(text="Sounds:")
+ sub.label(text="Temp:")
+ sub.label(text="Image Editor:")
+ sub.label(text="Animation Player:")
+
+ sub = col1.column()
+ sub.prop(paths, "font_directory", text="")
+ sub.prop(paths, "texture_directory", text="")
+ sub.prop(paths, "texture_plugin_directory", text="")
+ sub.prop(paths, "sequence_plugin_directory", text="")
+ sub.prop(paths, "render_output_directory", text="")
+ sub.prop(paths, "script_directory", text="")
+ sub.prop(paths, "sound_directory", text="")
+ sub.prop(paths, "temporary_directory", text="")
+ sub.prop(paths, "image_editor", text="")
+ subsplit = sub.split(percentage=0.3)
+ subsplit.prop(paths, "animation_player_preset", text="")
+ subsplit.prop(paths, "animation_player", text="")
+
+ col = split.column()
+ col.label(text="Save & Load:")
+ col.prop(paths, "use_relative_paths")
+ col.prop(paths, "use_file_compression")
+ col.prop(paths, "use_load_ui")
+ col.prop(paths, "use_filter_files")
+ col.prop(paths, "show_hidden_files_datablocks")
+ col.prop(paths, "hide_recent_locations")
+ col.prop(paths, "show_thumbnails")
+
+ col.separator()
+ col.separator()
+
+ col.prop(paths, "save_version")
+ col.prop(paths, "recent_files")
+ col.prop(paths, "use_save_preview_images")
+ col.label(text="Auto Save:")
+ col.prop(paths, "use_auto_save_temporary_files")
+ sub = col.column()
+ sub.active = paths.use_auto_save_temporary_files
+ sub.prop(paths, "auto_save_time", text="Timer (mins)")
+
+from bl_ui.space_userpref_keymap import InputKeyMapPanel
+
+
+class USERPREF_PT_input(InputKeyMapPanel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Input"
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'INPUT')
+
+ def draw_input_prefs(self, inputs, layout):
+ # General settings
+ row = layout.row()
+ col = row.column()
+
+ sub = col.column()
+ sub.label(text="Presets:")
+ subrow = sub.row(align=True)
+
+ subrow.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label)
+ subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMIN')
+ subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMOUT').remove_active = True
+ sub.separator()
+
+ sub.label(text="Mouse:")
+ sub1 = sub.column()
+ sub1.active = (inputs.select_mouse == 'RIGHT')
+ sub1.prop(inputs, "use_mouse_emulate_3_button")
+ sub.prop(inputs, "use_mouse_continuous")
+ sub.prop(inputs, "drag_threshold")
+
+ sub.label(text="Select With:")
+ sub.row().prop(inputs, "select_mouse", expand=True)
+
+ sub = col.column()
+ sub.label(text="Double Click:")
+ sub.prop(inputs, "mouse_double_click_time", text="Speed")
+
+ sub.separator()
+
+ sub.prop(inputs, "use_emulate_numpad")
+
+ sub.separator()
+
+ sub.label(text="Orbit Style:")
+ sub.row().prop(inputs, "view_rotate_method", expand=True)
+
+ sub.label(text="Zoom Style:")
+ sub.row().prop(inputs, "view_zoom_method", text="")
+ if inputs.view_zoom_method == 'DOLLY':
+ sub.row().prop(inputs, "view_zoom_axis", expand=True)
+ sub.prop(inputs, "invert_mouse_wheel_zoom")
+
+ #sub.prop(inputs, "use_mouse_mmb_paste")
+
+ #col.separator()
+
+ sub = col.column()
+ sub.label(text="Mouse Wheel:")
+ sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
+ #sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
+
+ col.separator()
+ ''' not implemented yet
+ sub = col.column()
+ sub.label(text="NDOF Device:")
+ sub.prop(inputs, "ndof_pan_speed", text="Pan Speed")
+ sub.prop(inputs, "ndof_rotate_speed", text="Orbit Speed")
+ '''
+
+ row.separator()
+
+ def draw(self, context):
+ layout = self.layout
+
+ #import time
+
+ #start = time.time()
+
+ userpref = context.user_preferences
+
+ inputs = userpref.inputs
+
+ split = layout.split(percentage=0.25)
+
+ # Input settings
+ self.draw_input_prefs(inputs, split)
+
+ # Keymap Settings
+ self.draw_keymaps(context, split)
+
+ #print("runtime", time.time() - start)
+
+
+class USERPREF_MT_addons_dev_guides(bpy.types.Menu):
+ bl_label = "Addons develoment guides"
+
+ # menu to open webpages with addons development guides
+ def draw(self, context):
+ layout = self.layout
+ layout.operator('wm.url_open', text='API Concepts'
+ ).url = 'http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro'
+ layout.operator('wm.url_open', text='Addons guidelines',
+ ).url = 'http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons'
+ layout.operator('wm.url_open', text='How to share your addon',
+ ).url = 'http://wiki.blender.org/index.php/Dev:Py/Sharing'
+
+
+class USERPREF_PT_addons(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Addons"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ _addons_fake_modules = {}
+
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'ADDONS')
+
+ @staticmethod
+ def module_get(mod_name):
+ return USERPREF_PT_addons._addons_fake_modules[mod_name]
+
+ def draw(self, context):
+ layout = self.layout
+
+ userpref = context.user_preferences
+ used_ext = {ext.module for ext in userpref.addons}
+
+ # collect the categories that can be filtered on
+ addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules)]
+
+ split = layout.split(percentage=0.2)
+ col = split.column()
+ col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
+ col.prop(context.window_manager, "addon_filter", expand=True)
+
+ col.label(text="Supported Level")
+ col.prop(context.window_manager, "addon_support", expand=True)
+
+ col = split.column()
+
+ filter = context.window_manager.addon_filter
+ search = context.window_manager.addon_search.lower()
+ support = context.window_manager.addon_support
+
+ for mod, info in addons:
+ module_name = mod.__name__
+
+ is_enabled = module_name in used_ext
+
+ if info["support"] not in support:
+ continue
+
+ # check if add-on should be visible with current filters
+ if (filter == "All") or \
+ (filter == info["category"]) or \
+ (filter == "Enabled" and is_enabled) or \
+ (filter == "Disabled" and not is_enabled):
+
+ if search and search not in info["name"].lower():
+ if info["author"]:
+ if search not in info["author"].lower():
+ continue
+ else:
+ continue
+
+ # Addon UI Code
+ box = col.column().box()
+ colsub = box.column()
+ row = colsub.row()
+
+ row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
+
+ rowsub = row.row()
+ rowsub.active = is_enabled
+ rowsub.label(text='%s: %s' % (info['category'], info["name"]))
+ if info["warning"]:
+ rowsub.label(icon='ERROR')
+
+ # icon showing support level.
+ if info["support"] == 'OFFICIAL':
+ rowsub.label(icon='FILE_BLEND')
+ elif info["support"] == 'COMMUNITY':
+ rowsub.label(icon='POSE_DATA')
+ else:
+ rowsub.label(icon='QUESTION')
+
+ if is_enabled:
+ row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
+ else:
+ row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
+
+ # Expanded UI (only if additional infos are available)
+ if info["show_expanded"]:
+ if info["description"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text='Description:')
+ split.label(text=info["description"])
+ if info["location"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text='Location:')
+ split.label(text=info["location"])
+ if info["author"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text='Author:')
+ split.label(text=info["author"])
+ if info["version"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text='Version:')
+ split.label(text='.'.join(str(x) for x in info["version"]))
+ if info["warning"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text="Warning:")
+ split.label(text=' ' + info["warning"], icon='ERROR')
+ if info["wiki_url"] or info["tracker_url"]:
+ split = colsub.row().split(percentage=0.15)
+ split.label(text="Internet:")
+ if info["wiki_url"]:
+ split.operator("wm.url_open", text="Link to the Wiki", icon='HELP').url = info["wiki_url"]
+ if info["tracker_url"]:
+ split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info["tracker_url"]
+
+ if info["wiki_url"] and info["tracker_url"]:
+ split.separator()
+ else:
+ split.separator()
+ split.separator()
+
+ # Append missing scripts
+ # First collect scripts that are used but have no script file.
+ module_names = {mod.__name__ for mod, info in addons}
+ missing_modules = {ext for ext in used_ext if ext not in module_names}
+
+ if missing_modules and filter in {"All", "Enabled"}:
+ col.column().separator()
+ col.column().label(text="Missing script files")
+
+ module_names = {mod.__name__ for mod, info in addons}
+ for module_name in sorted(missing_modules):
+ is_enabled = module_name in used_ext
+ # Addon UI Code
+ box = col.column().box()
+ colsub = box.column()
+ row = colsub.row()
+
+ row.label(text=module_name, icon='ERROR')
+
+ if is_enabled:
+ row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
+
+
+class WM_OT_addon_enable(bpy.types.Operator):
+ "Enable an addon"
+ bl_idname = "wm.addon_enable"
+ bl_label = "Enable Add-On"
+
+ module = StringProperty(name="Module", description="Module name of the addon to enable")
+
+ def execute(self, context):
+ mod = addon_utils.enable(self.module)
+
+ if mod:
+ # check if add-on is written for current blender version, or raise a warning
+ info = addon_utils.module_bl_info(mod)
+
+ if info.get("blender", (0, 0, 0)) > bpy.app.version:
+ self.report("WARNING','This script was written for a newer version of Blender and might not function (correctly).\nThe script is enabled though.")
+ return {'FINISHED'}
+ else:
+ return {'CANCELLED'}
+
+
+class WM_OT_addon_disable(bpy.types.Operator):
+ "Disable an addon"
+ bl_idname = "wm.addon_disable"
+ bl_label = "Disable Add-On"
+
+ module = StringProperty(name="Module", description="Module name of the addon to disable")
+
+ def execute(self, context):
+ addon_utils.disable(self.module)
+ return {'FINISHED'}
+
+
+class WM_OT_addon_install(bpy.types.Operator):
+ "Install an addon"
+ bl_idname = "wm.addon_install"
+ bl_label = "Install Add-On..."
+
+ overwrite = BoolProperty(name="Overwrite", description="Remove existing addons with the same ID", default=True)
+
+ filepath = StringProperty(name="File Path", description="File path to write file to")
+ filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
+ filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
+ filter_glob = StringProperty(default="*.py;*.zip", options={'HIDDEN'})
+
+ @staticmethod
+ def _module_remove(path_addons, module):
+ module = os.path.splitext(module)[0]
+ for f in os.listdir(path_addons):
+ f_base = os.path.splitext(f)[0]
+ if f_base == module:
+ f_full = os.path.join(path_addons, f)
+
+ if os.path.isdir(f_full):
+ os.rmdir(f_full)
+ else:
+ os.remove(f_full)
+
+ def execute(self, context):
+ import traceback
+ import zipfile
+ import shutil
+
+ pyfile = self.filepath
+
+ # dont use bpy.utils.script_paths("addons") because we may not be able to write to it.
+ path_addons = bpy.utils.user_resource('SCRIPTS', "addons", create=True)
+
+ if not path_addons:
+ self.report({'ERROR'}, "Failed to get addons path")
+ return {'CANCELLED'}
+
+ # Check if we are installing from a target path,
+ # doing so causes 2+ addons of same name or when the same from/to
+ # location is used, removal of the file!
+ addon_path = ""
+ pyfile_dir = os.path.dirname(pyfile)
+ for addon_path in addon_utils.paths():
+ if os.path.samefile(pyfile_dir, addon_path):
+ self.report({'ERROR'}, "Source file is in the addon search path: %r" % addon_path)
+ return {'CANCELLED'}
+ del addon_path
+ del pyfile_dir
+ # done checking for exceptional case
+
+ contents = set(os.listdir(path_addons))
+
+ #check to see if the file is in compressed format (.zip)
+ if zipfile.is_zipfile(pyfile):
+ try:
+ file_to_extract = zipfile.ZipFile(pyfile, 'r')
+ except:
+ traceback.print_exc()
+ return {'CANCELLED'}
+
+ if self.overwrite:
+ for f in file_to_extract.namelist():
+ __class__._module_remove(path_addons, f)
+ else:
+ for f in file_to_extract.namelist():
+ path_dest = os.path.join(path_addons, os.path.basename(f))
+ if os.path.exists(path_dest):
+ self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
+ return {'CANCELLED'}
+
+ try: # extract the file to "addons"
+ file_to_extract.extractall(path_addons)
+ except:
+ traceback.print_exc()
+ return {'CANCELLED'}
+
+ else:
+ path_dest = os.path.join(path_addons, os.path.basename(pyfile))
+
+ if self.overwrite:
+ __class__._module_remove(path_addons, os.path.basename(pyfile))
+ elif os.path.exists(path_dest):
+ self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
+ return {'CANCELLED'}
+
+ #if not compressed file just copy into the addon path
+ try:
+ shutil.copyfile(pyfile, path_dest)
+
+ except:
+ traceback.print_exc()
+ return {'CANCELLED'}
+
+ # disable any addons we may have enabled previously and removed.
+ # this is unlikely but do just incase. bug [#23978]
+ addons_new = set(os.listdir(path_addons)) - contents
+ for new_addon in addons_new:
+ addon_utils.disable(os.path.splitext(new_addon)[0])
+
+ # possible the zip contains multiple addons, we could disallow this
+ # but for now just use the first
+ for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules):
+ if mod.__name__ in addons_new:
+ info = addon_utils.module_bl_info(mod)
+
+ # show the newly installed addon.
+ context.window_manager.addon_filter = 'All'
+ context.window_manager.addon_search = info["name"]
+ break
+
+ # TODO, should not be a warning.
+ # self.report({'WARNING'}, "File installed to '%s'\n" % path_dest)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+
+class WM_OT_addon_expand(bpy.types.Operator):
+ "Display more information on this add-on"
+ bl_idname = "wm.addon_expand"
+ bl_label = ""
+
+ module = StringProperty(name="Module", description="Module name of the addon to expand")
+
+ def execute(self, context):
+ module_name = self.module
+
+ # unlikely to fail, module should have already been imported
+ try:
+ # mod = __import__(module_name)
+ mod = USERPREF_PT_addons.module_get(module_name)
+ except:
+ import traceback
+ traceback.print_exc()
+ return {'CANCELLED'}
+
+ info = addon_utils.module_bl_info(mod)
+ info["show_expanded"] = not info["show_expanded"]
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/space_userpref_keymap.py b/release/scripts/startup/bl_ui/space_userpref_keymap.py
new file mode 100644
index 00000000000..4b3ff36abe9
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_userpref_keymap.py
@@ -0,0 +1,781 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+import os
+
+
+KM_HIERARCHY = [
+ ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
+ ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
+ ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners
+ ]),
+
+ ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region)
+ ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation
+ ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region)
+ ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region)
+
+ ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform)
+ ('Object Mode', 'EMPTY', 'WINDOW', []),
+ ('Mesh', 'EMPTY', 'WINDOW', []),
+ ('Curve', 'EMPTY', 'WINDOW', []),
+ ('Armature', 'EMPTY', 'WINDOW', []),
+ ('Metaball', 'EMPTY', 'WINDOW', []),
+ ('Lattice', 'EMPTY', 'WINDOW', []),
+ ('Font', 'EMPTY', 'WINDOW', []),
+
+ ('Pose', 'EMPTY', 'WINDOW', []),
+
+ ('Vertex Paint', 'EMPTY', 'WINDOW', []),
+ ('Weight Paint', 'EMPTY', 'WINDOW', []),
+ ('Face Mask', 'EMPTY', 'WINDOW', []),
+ ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
+ ('Sculpt', 'EMPTY', 'WINDOW', []),
+
+ ('Armature Sketch', 'EMPTY', 'WINDOW', []),
+ ('Particle', 'EMPTY', 'WINDOW', []),
+
+ ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change
+
+ ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties
+ ]),
+
+ ('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region)
+ ('Markers', 'EMPTY', 'WINDOW', []), # markers (per region)
+ ('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region)
+ ('Animation Channels', 'EMPTY', 'WINDOW', []),
+ ('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [
+ ('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', [])
+ ]),
+ ('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', []),
+ ('NLA Editor', 'NLA_EDITOR', 'WINDOW', [
+ ('NLA Channels', 'NLA_EDITOR', 'WINDOW', []),
+ ('NLA Generic', 'NLA_EDITOR', 'WINDOW', [])
+ ]),
+
+ ('Image', 'IMAGE_EDITOR', 'WINDOW', [
+ ('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
+ ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
+ ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [])
+ ]),
+
+ ('Timeline', 'TIMELINE', 'WINDOW', []),
+ ('Outliner', 'OUTLINER', 'WINDOW', []),
+
+ ('Node Editor', 'NODE_EDITOR', 'WINDOW', [
+ ('Node Generic', 'NODE_EDITOR', 'WINDOW', [])
+ ]),
+ ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []),
+ ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []),
+
+ ('File Browser', 'FILE_BROWSER', 'WINDOW', [
+ ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []),
+ ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', [])
+ ]),
+
+ ('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
+
+ ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
+ ('Text', 'TEXT_EDITOR', 'WINDOW', []),
+ ('Console', 'CONSOLE', 'WINDOW', []),
+
+ ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []),
+ ('Gesture Border', 'EMPTY', 'WINDOW', []),
+ ('Standard Modal Map', 'EMPTY', 'WINDOW', []),
+ ('Transform Modal Map', 'EMPTY', 'WINDOW', []),
+ ('View3D Fly Modal', 'EMPTY', 'WINDOW', []),
+ ('View3D Rotate Modal', 'EMPTY', 'WINDOW', []),
+ ('View3D Move Modal', 'EMPTY', 'WINDOW', []),
+ ('View3D Zoom Modal', 'EMPTY', 'WINDOW', []),
+ ]
+
+
+def _km_exists_in(km, export_keymaps):
+ for km2, kc in export_keymaps:
+ if km2.name == km.name:
+ return True
+ return False
+
+
+def _merge_keymaps(kc1, kc2):
+ """ note: kc1 takes priority over kc2
+ """
+ merged_keymaps = [(km, kc1) for km in kc1.keymaps]
+ if kc1 != kc2:
+ merged_keymaps.extend((km, kc2) for km in kc2.keymaps if not _km_exists_in(km, merged_keymaps))
+
+ return merged_keymaps
+
+
+class USERPREF_MT_keyconfigs(bpy.types.Menu):
+ bl_label = "KeyPresets"
+ preset_subdir = "keyconfig"
+ preset_operator = "wm.keyconfig_activate"
+
+ def draw(self, context):
+ props = self.layout.operator("wm.context_set_value", text="Blender (default)")
+ props.data_path = "window_manager.keyconfigs.active"
+ props.value = "context.window_manager.keyconfigs.default"
+
+ # now draw the presets
+ bpy.types.Menu.draw_preset(self, context)
+
+
+class InputKeyMapPanel(bpy.types.Panel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_label = "Input"
+ bl_region_type = 'WINDOW'
+ bl_options = {'HIDE_HEADER'}
+
+ def draw_entry(self, display_keymaps, entry, col, level=0):
+ idname, spaceid, regionid, children = entry
+
+ for km, kc in display_keymaps:
+ if km.name == idname and km.space_type == spaceid and km.region_type == regionid:
+ self.draw_km(display_keymaps, kc, km, children, col, level)
+
+ '''
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
+ if not km:
+ kc = defkc
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
+
+ if km:
+ self.draw_km(kc, km, children, col, level)
+ '''
+
+ def indented_layout(self, layout, level):
+ indentpx = 16
+ if level == 0:
+ level = 0.0001 # Tweak so that a percentage of 0 won't split by half
+ indent = level * indentpx / bpy.context.region.width
+
+ split = layout.split(percentage=indent)
+ col = split.column()
+ col = split.column()
+ return col
+
+ def draw_km(self, display_keymaps, kc, km, children, layout, level):
+ km = km.active()
+
+ layout.context_pointer_set("keymap", km)
+
+ col = self.indented_layout(layout, level)
+
+ row = col.row()
+ row.prop(km, "show_expanded_children", text="", emboss=False)
+ row.label(text=km.name)
+
+ row.label()
+ row.label()
+
+ if km.is_modal:
+ row.label(text="", icon='LINKED')
+ if km.is_user_defined:
+ op = row.operator("wm.keymap_restore", text="Restore")
+ else:
+ op = row.operator("wm.keymap_edit", text="Edit")
+
+ if km.show_expanded_children:
+ if children:
+ # Put the Parent key map's entries in a 'global' sub-category
+ # equal in hierarchy to the other children categories
+ subcol = self.indented_layout(col, level + 1)
+ subrow = subcol.row()
+ subrow.prop(km, "show_expanded_items", text="", emboss=False)
+ subrow.label(text="%s (Global)" % km.name)
+ else:
+ km.show_expanded_items = True
+
+ # Key Map items
+ if km.show_expanded_items:
+ for kmi in km.items:
+ self.draw_kmi(display_keymaps, kc, km, kmi, col, level + 1)
+
+ # "Add New" at end of keymap item list
+ col = self.indented_layout(col, level + 1)
+ subcol = col.split(percentage=0.2).column()
+ subcol.enabled = km.is_user_defined
+ op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
+
+ col.separator()
+
+ # Child key maps
+ if children:
+ subcol = col.column()
+ row = subcol.row()
+
+ for entry in children:
+ self.draw_entry(display_keymaps, entry, col, level + 1)
+
+ @staticmethod
+ def draw_kmi_properties(box, properties, title=None):
+ box.separator()
+ if title:
+ box.label(text=title)
+ flow = box.column_flow(columns=2)
+ for pname, value in properties.bl_rna.properties.items():
+ if pname != "rna_type" and not properties.is_property_hidden(pname):
+ if isinstance(value, bpy.types.OperatorProperties):
+ __class__.draw_kmi_properties(box, value, title=pname)
+ else:
+ flow.prop(properties, pname)
+
+ def draw_kmi(self, display_keymaps, kc, km, kmi, layout, level):
+ map_type = kmi.map_type
+
+ col = self.indented_layout(layout, level)
+
+ if km.is_user_defined:
+ col = col.column(align=True)
+ box = col.box()
+ else:
+ box = col.column()
+
+ split = box.split(percentage=0.05)
+
+ # header bar
+ row = split.row()
+ row.prop(kmi, "show_expanded", text="", emboss=False)
+
+ row = split.row()
+ row.enabled = km.is_user_defined
+ row.prop(kmi, "active", text="", emboss=False)
+
+ if km.is_modal:
+ row.prop(kmi, "propvalue", text="")
+ else:
+ row.label(text=kmi.name)
+
+ row = split.row()
+ row.enabled = km.is_user_defined
+ row.prop(kmi, "map_type", text="")
+ if map_type == 'KEYBOARD':
+ row.prop(kmi, "type", text="", full_event=True)
+ elif map_type == 'MOUSE':
+ row.prop(kmi, "type", text="", full_event=True)
+ elif map_type == 'TWEAK':
+ subrow = row.row()
+ subrow.prop(kmi, "type", text="")
+ subrow.prop(kmi, "value", text="")
+ elif map_type == 'TIMER':
+ row.prop(kmi, "type", text="")
+ else:
+ row.label()
+
+ if not kmi.is_user_defined:
+ op = row.operator("wm.keyitem_restore", text="", icon='BACK')
+ op.item_id = kmi.id
+ op = row.operator("wm.keyitem_remove", text="", icon='X')
+ op.item_id = kmi.id
+
+ # Expanded, additional event settings
+ if kmi.show_expanded:
+ box = col.box()
+
+ box.enabled = km.is_user_defined
+
+ if map_type not in {'TEXTINPUT', 'TIMER'}:
+ split = box.split(percentage=0.4)
+ sub = split.row()
+
+ if km.is_modal:
+ sub.prop(kmi, "propvalue", text="")
+ else:
+ # One day...
+ # sub.prop_search(kmi, "idname", bpy.context.window_manager, "operators_all", text="")
+ sub.prop(kmi, "idname", text="")
+
+ sub = split.column()
+ subrow = sub.row(align=True)
+
+ if map_type == 'KEYBOARD':
+ subrow.prop(kmi, "type", text="", event=True)
+ subrow.prop(kmi, "value", text="")
+ elif map_type == 'MOUSE':
+ subrow.prop(kmi, "type", text="")
+ subrow.prop(kmi, "value", text="")
+
+ subrow = sub.row()
+ subrow.scale_x = 0.75
+ subrow.prop(kmi, "any")
+ subrow.prop(kmi, "shift")
+ subrow.prop(kmi, "ctrl")
+ subrow.prop(kmi, "alt")
+ subrow.prop(kmi, "oskey", text="Cmd")
+ subrow.prop(kmi, "key_modifier", text="", event=True)
+
+ # Operator properties
+ props = kmi.properties
+ if props is not None:
+ __class__.draw_kmi_properties(box, props)
+
+ # Modal key maps attached to this operator
+ if not km.is_modal:
+ kmm = kc.keymaps.find_modal(kmi.idname)
+ if kmm:
+ self.draw_km(display_keymaps, kc, kmm, None, layout, level + 1)
+ layout.context_pointer_set("keymap", km)
+
+ def draw_filtered(self, display_keymaps, filter_text, layout):
+ for km, kc in display_keymaps:
+ km = km.active()
+ layout.context_pointer_set("keymap", km)
+
+ filtered_items = [kmi for kmi in km.items if filter_text in kmi.name.lower()]
+
+ if len(filtered_items) != 0:
+ col = layout.column()
+
+ row = col.row()
+ row.label(text=km.name, icon="DOT")
+
+ row.label()
+ row.label()
+
+ if km.is_user_defined:
+ op = row.operator("wm.keymap_restore", text="Restore")
+ else:
+ op = row.operator("wm.keymap_edit", text="Edit")
+
+ for kmi in filtered_items:
+ self.draw_kmi(display_keymaps, kc, km, kmi, col, 1)
+
+ # "Add New" at end of keymap item list
+ col = self.indented_layout(layout, 1)
+ subcol = col.split(percentage=0.2).column()
+ subcol.enabled = km.is_user_defined
+ op = subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
+
+ def draw_hierarchy(self, display_keymaps, layout):
+ for entry in KM_HIERARCHY:
+ self.draw_entry(display_keymaps, entry, layout)
+
+ def draw_keymaps(self, context, layout):
+ wm = context.window_manager
+ kc = wm.keyconfigs.active
+ defkc = wm.keyconfigs.default
+
+ col = layout.column()
+ sub = col.column()
+
+ subsplit = sub.split()
+ subcol = subsplit.column()
+
+ row = subcol.row(align=True)
+
+ #row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config:")
+ text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
+ if not text:
+ text = "Blender (default)"
+ row.menu("USERPREF_MT_keyconfigs", text=text)
+ row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMIN")
+ row.operator("wm.keyconfig_preset_add", text="", icon="ZOOMOUT").remove_active = True
+
+# layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
+# row.operator("wm.keyconfig_remove", text="", icon='X')
+
+ row.prop(context.space_data, "filter_text", icon="VIEWZOOM")
+
+ col.separator()
+
+ display_keymaps = _merge_keymaps(kc, defkc)
+ if context.space_data.filter_text != "":
+ filter_text = context.space_data.filter_text.lower()
+ self.draw_filtered(display_keymaps, filter_text, col)
+ else:
+ self.draw_hierarchy(display_keymaps, col)
+
+
+from bpy.props import StringProperty, BoolProperty, IntProperty
+
+
+def export_properties(prefix, properties, lines=None):
+ if lines is None:
+ lines = []
+
+ for pname in properties.keys():
+ if not properties.is_property_hidden(pname):
+ value = getattr(properties, pname)
+ if isinstance(value, bpy.types.OperatorProperties):
+ export_properties(prefix + "." + pname, value, lines)
+ elif properties.is_property_set(pname):
+ value = _string_value(value)
+ if value != "":
+ lines.append("%s.%s = %s\n" % (prefix, pname, value))
+ return lines
+
+
+class WM_OT_keyconfig_test(bpy.types.Operator):
+ "Test keyconfig for conflicts"
+ bl_idname = "wm.keyconfig_test"
+ bl_label = "Test Key Configuration for Conflicts"
+
+ def testEntry(self, kc, entry, src=None, parent=None):
+ result = False
+
+ def kmistr(kmi):
+ if km.is_modal:
+ s = ["kmi = km.items.new_modal(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
+ else:
+ s = ["kmi = km.items.new(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
+
+ if kmi.any:
+ s.append(", any=True")
+ else:
+ if kmi.shift:
+ s.append(", shift=True")
+ if kmi.ctrl:
+ s.append(", ctrl=True")
+ if kmi.alt:
+ s.append(", alt=True")
+ if kmi.oskey:
+ s.append(", oskey=True")
+ if kmi.key_modifier and kmi.key_modifier != 'NONE':
+ s.append(", key_modifier=\'%s\'" % kmi.key_modifier)
+
+ s.append(")\n")
+
+ props = kmi.properties
+
+ if props is not None:
+ export_properties("kmi.properties", props, s)
+
+ return "".join(s).strip()
+
+ idname, spaceid, regionid, children = entry
+
+ km = kc.keymaps.find(idname, space_type=spaceid, region_type=regionid)
+
+ if km:
+ km = km.active()
+
+ if src:
+ for item in km.items:
+ if src.compare(item):
+ print("===========")
+ print(parent.name)
+ print(kmistr(src))
+ print(km.name)
+ print(kmistr(item))
+ result = True
+
+ for child in children:
+ if self.testEntry(kc, child, src, parent):
+ result = True
+ else:
+ for i in range(len(km.items)):
+ src = km.items[i]
+
+ for child in children:
+ if self.testEntry(kc, child, src, km):
+ result = True
+
+ for j in range(len(km.items) - i - 1):
+ item = km.items[j + i + 1]
+ if src.compare(item):
+ print("===========")
+ print(km.name)
+ print(kmistr(src))
+ print(kmistr(item))
+ result = True
+
+ for child in children:
+ if self.testEntry(kc, child):
+ result = True
+
+ return result
+
+ def testConfig(self, kc):
+ result = False
+ for entry in KM_HIERARCHY:
+ if self.testEntry(kc, entry):
+ result = True
+ return result
+
+ def execute(self, context):
+ wm = context.window_manager
+ kc = wm.keyconfigs.default
+
+ if self.testConfig(kc):
+ print("CONFLICT")
+
+ return {'FINISHED'}
+
+
+def _string_value(value):
+ if isinstance(value, str) or isinstance(value, bool) or isinstance(value, float) or isinstance(value, int):
+ result = repr(value)
+ elif getattr(value, '__len__', False):
+ return repr(list(value))
+ else:
+ print("Export key configuration: can't write ", value)
+
+ return result
+
+
+class WM_OT_keyconfig_import(bpy.types.Operator):
+ "Import key configuration from a python script"
+ bl_idname = "wm.keyconfig_import"
+ bl_label = "Import Key Configuration..."
+
+ filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
+ filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
+ filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
+ filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
+
+ keep_original = BoolProperty(name="Keep original", description="Keep original file after copying to configuration folder", default=True)
+
+ def execute(self, context):
+ from os.path import basename
+ import shutil
+ if not self.filepath:
+ raise Exception("Filepath not set")
+
+ f = open(self.filepath, "r")
+ if not f:
+ raise Exception("Could not open file")
+
+ config_name = basename(self.filepath)
+
+ path = bpy.utils.preset_paths("keyconfig")[0] # we need some way to tell the user and system preset path
+ print(path)
+
+ # create config folder if needed
+ if not os.path.exists(path):
+ os.mkdir(path)
+
+ path = os.path.join(path, config_name)
+
+ if self.keep_original:
+ shutil.copy(self.filepath, path)
+ else:
+ shutil.move(self.filepath, path)
+
+ # sneaky way to check we're actually running the code.
+ bpy.utils.keyconfig_set(path)
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+# This operator is also used by interaction presets saving - AddPresetBase
+
+
+class WM_OT_keyconfig_export(bpy.types.Operator):
+ "Export key configuration to a python script"
+ bl_idname = "wm.keyconfig_export"
+ bl_label = "Export Key Configuration..."
+
+ filepath = StringProperty(name="File Path", description="Filepath to write file to", default="keymap.py")
+ filter_folder = BoolProperty(name="Filter folders", description="", default=True, options={'HIDDEN'})
+ filter_text = BoolProperty(name="Filter text", description="", default=True, options={'HIDDEN'})
+ filter_python = BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'})
+
+ def execute(self, context):
+ if not self.filepath:
+ raise Exception("Filepath not set")
+
+ f = open(self.filepath, "w")
+ if not f:
+ raise Exception("Could not open file")
+
+ wm = context.window_manager
+ kc = wm.keyconfigs.active
+
+ f.write("import bpy\n")
+ f.write("import os\n\n")
+ f.write("wm = bpy.context.window_manager\n")
+ f.write("kc = wm.keyconfigs.new(os.path.splitext(os.path.basename(__file__))[0])\n\n") # keymap must be created by caller
+
+ # Generate a list of keymaps to export:
+ #
+ # First add all user_defined keymaps (found in inputs.edited_keymaps list),
+ # then add all remaining keymaps from the currently active custom keyconfig.
+ #
+ # This will create a final list of keymaps that can be used as a 'diff' against
+ # the default blender keyconfig, recreating the current setup from a fresh blender
+ # without needing to export keymaps which haven't been edited.
+
+ class FakeKeyConfig():
+ keymaps = []
+ edited_kc = FakeKeyConfig()
+ edited_kc.keymaps.extend(context.user_preferences.inputs.edited_keymaps)
+ # merge edited keymaps with non-default keyconfig, if it exists
+ if kc != wm.keyconfigs.default:
+ export_keymaps = _merge_keymaps(edited_kc, kc)
+ else:
+ export_keymaps = _merge_keymaps(edited_kc, edited_kc)
+
+ for km, kc_x in export_keymaps:
+
+ km = km.active()
+
+ f.write("# Map %s\n" % km.name)
+ f.write("km = kc.keymaps.new('%s', space_type='%s', region_type='%s', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.is_modal))
+ for kmi in km.items:
+ if km.is_modal:
+ f.write("kmi = km.items.new_modal('%s', '%s', '%s'" % (kmi.propvalue, kmi.type, kmi.value))
+ else:
+ f.write("kmi = km.items.new('%s', '%s', '%s'" % (kmi.idname, kmi.type, kmi.value))
+ if kmi.any:
+ f.write(", any=True")
+ else:
+ if kmi.shift:
+ f.write(", shift=True")
+ if kmi.ctrl:
+ f.write(", ctrl=True")
+ if kmi.alt:
+ f.write(", alt=True")
+ if kmi.oskey:
+ f.write(", oskey=True")
+ if kmi.key_modifier and kmi.key_modifier != 'NONE':
+ f.write(", key_modifier='%s'" % kmi.key_modifier)
+ f.write(")\n")
+
+ props = kmi.properties
+
+ if props is not None:
+ f.write("".join(export_properties("kmi.properties", props)))
+
+ f.write("\n")
+
+ f.close()
+
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ wm = context.window_manager
+ wm.fileselect_add(self)
+ return {'RUNNING_MODAL'}
+
+
+class WM_OT_keymap_edit(bpy.types.Operator):
+ "Edit stored key map"
+ bl_idname = "wm.keymap_edit"
+ bl_label = "Edit Key Map"
+
+ def execute(self, context):
+ km = context.keymap
+ km.copy_to_user()
+ return {'FINISHED'}
+
+
+class WM_OT_keymap_restore(bpy.types.Operator):
+ "Restore key map(s)"
+ bl_idname = "wm.keymap_restore"
+ bl_label = "Restore Key Map(s)"
+
+ all = BoolProperty(name="All Keymaps", description="Restore all keymaps to default")
+
+ def execute(self, context):
+ wm = context.window_manager
+
+ if self.all:
+ for km in wm.keyconfigs.default.keymaps:
+ km.restore_to_default()
+ else:
+ km = context.keymap
+ km.restore_to_default()
+
+ return {'FINISHED'}
+
+
+class WM_OT_keyitem_restore(bpy.types.Operator):
+ "Restore key map item"
+ bl_idname = "wm.keyitem_restore"
+ bl_label = "Restore Key Map Item"
+
+ item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
+
+ @classmethod
+ def poll(cls, context):
+ return hasattr(context, "keymap") and context.keymap.is_user_defined
+
+ def execute(self, context):
+ km = context.keymap
+ kmi = km.items.from_id(self.item_id)
+
+ if not kmi.is_user_defined:
+ km.restore_item_to_default(kmi)
+
+ return {'FINISHED'}
+
+
+class WM_OT_keyitem_add(bpy.types.Operator):
+ "Add key map item"
+ bl_idname = "wm.keyitem_add"
+ bl_label = "Add Key Map Item"
+
+ def execute(self, context):
+ wm = context.window_manager
+ km = context.keymap
+ kc = wm.keyconfigs.default
+
+ if km.is_modal:
+ km.items.new_modal("", 'A', 'PRESS') # kmi
+ else:
+ km.items.new("none", 'A', 'PRESS') # kmi
+
+ # clear filter and expand keymap so we can see the newly added item
+ if context.space_data.filter_text != "":
+ context.space_data.filter_text = ""
+ km.show_expanded_items = True
+ km.show_expanded_children = True
+
+ return {'FINISHED'}
+
+
+class WM_OT_keyitem_remove(bpy.types.Operator):
+ "Remove key map item"
+ bl_idname = "wm.keyitem_remove"
+ bl_label = "Remove Key Map Item"
+
+ item_id = IntProperty(name="Item Identifier", description="Identifier of the item to remove")
+
+ @classmethod
+ def poll(cls, context):
+ return hasattr(context, "keymap") and context.keymap.is_user_defined
+
+ def execute(self, context):
+ km = context.keymap
+ kmi = km.items.from_id(self.item_id)
+ km.items.remove(kmi)
+ return {'FINISHED'}
+
+
+class WM_OT_keyconfig_remove(bpy.types.Operator):
+ "Remove key config"
+ bl_idname = "wm.keyconfig_remove"
+ bl_label = "Remove Key Config"
+
+ @classmethod
+ def poll(cls, context):
+ wm = context.window_manager
+ return wm.keyconfigs.active.is_user_defined
+
+ def execute(self, context):
+ wm = context.window_manager
+ keyconfig = wm.keyconfigs.active
+ wm.keyconfigs.remove(keyconfig)
+ return {'FINISHED'}
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
new file mode 100644
index 00000000000..31704173258
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -0,0 +1,2315 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class VIEW3D_HT_header(bpy.types.Header):
+ bl_space_type = 'VIEW_3D'
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+ mode_string = context.mode
+ edit_object = context.edit_object
+ obj = context.active_object
+ toolsettings = context.tool_settings
+
+ row = layout.row(align=True)
+ row.template_header()
+
+ # Menus
+ if context.area.show_menus:
+ sub = row.row(align=True)
+
+ sub.menu("VIEW3D_MT_view")
+
+ # Select Menu
+ if mode_string not in {'EDIT_TEXT', 'SCULPT', 'PAINT_WEIGHT', 'PAINT_VERTEX', 'PAINT_TEXTURE'}:
+ sub.menu("VIEW3D_MT_select_%s" % mode_string.lower())
+
+ if edit_object:
+ sub.menu("VIEW3D_MT_edit_%s" % edit_object.type.lower())
+ elif obj:
+ if mode_string not in {'PAINT_TEXTURE'}:
+ sub.menu("VIEW3D_MT_%s" % mode_string.lower())
+ else:
+ sub.menu("VIEW3D_MT_object")
+
+ row = layout.row()
+ row.template_header_3D()
+
+ # do in C for now since these buttons cant be both toggle AND exclusive.
+ '''
+ if obj and obj.mode == 'EDIT' and obj.type == 'MESH':
+ row_sub = row.row(align=True)
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=0, icon='VERTEXSEL')
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=1, icon='EDGESEL')
+ row_sub.prop(toolsettings, "mesh_select_mode", text="", index=2, icon='FACESEL')
+ '''
+
+ if obj:
+ # Particle edit
+ if obj.mode == 'PARTICLE_EDIT':
+ row.prop(toolsettings.particle_edit, "select_mode", text="", expand=True, toggle=True)
+
+ # Occlude geometry
+ if view.viewport_shade in {'SOLID', 'SHADED', 'TEXTURED'} and (obj.mode == 'PARTICLE_EDIT' or (obj.mode == 'EDIT' and obj.type == 'MESH')):
+ row.prop(view, "use_occlude_geometry", text="")
+
+ # Proportional editing
+ if obj.mode in {'EDIT', 'PARTICLE_EDIT'}:
+ row = layout.row(align=True)
+ row.prop(toolsettings, "proportional_edit", text="", icon_only=True)
+ if toolsettings.proportional_edit != 'DISABLED':
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
+ elif obj.mode == 'OBJECT':
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_proportional_edit_objects", text="", icon_only=True)
+ if toolsettings.use_proportional_edit_objects:
+ row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
+
+ # Snap
+ row = layout.row(align=True)
+ row.prop(toolsettings, "use_snap", text="")
+ row.prop(toolsettings, "snap_element", text="", icon_only=True)
+ if toolsettings.snap_element != 'INCREMENT':
+ row.prop(toolsettings, "snap_target", text="")
+ if obj and obj.mode == 'OBJECT':
+ row.prop(toolsettings, "use_snap_align_rotation", text="")
+ if toolsettings.snap_element == 'VOLUME':
+ row.prop(toolsettings, "use_snap_peel_object", text="")
+ elif toolsettings.snap_element == 'FACE':
+ row.prop(toolsettings, "use_snap_project", text="")
+
+ # OpenGL render
+ row = layout.row(align=True)
+ row.operator("render.opengl", text="", icon='RENDER_STILL')
+ props = row.operator("render.opengl", text="", icon='RENDER_ANIMATION')
+ props.animation = True
+
+ # Pose
+ if obj and obj.mode == 'POSE':
+ row = layout.row(align=True)
+ row.operator("pose.copy", text="", icon='COPYDOWN')
+ row.operator("pose.paste", text="", icon='PASTEDOWN')
+ props = row.operator("pose.paste", text="", icon='PASTEFLIPDOWN')
+ props.flipped = 1
+
+
+# ********** Menu **********
+
+# ********** Utilities **********
+
+
+class ShowHideMenu():
+ bl_label = "Show/Hide"
+ _operator_name = ""
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("%s.reveal" % self._operator_name, text="Show Hidden")
+ layout.operator("%s.hide" % self._operator_name, text="Hide Selected")
+ layout.operator("%s.hide" % self._operator_name, text="Hide Unselected").unselected = True
+
+
+class VIEW3D_MT_transform(bpy.types.Menu):
+ bl_label = "Transform"
+
+ # TODO: get rid of the custom text strings?
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("transform.translate", text="Grab/Move")
+ # TODO: sub-menu for grab per axis
+ layout.operator("transform.rotate", text="Rotate")
+ # TODO: sub-menu for rot per axis
+ layout.operator("transform.resize", text="Scale")
+ # TODO: sub-menu for scale per axis
+
+ layout.separator()
+
+ layout.operator("transform.tosphere", text="To Sphere")
+ layout.operator("transform.shear", text="Shear")
+ layout.operator("transform.warp", text="Warp")
+ layout.operator("transform.push_pull", text="Push/Pull")
+
+ layout.separator()
+
+ layout.operator("transform.translate", text="Move Texture Space").texture_space = True
+ layout.operator("transform.resize", text="Scale Texture Space").texture_space = True
+
+ layout.separator()
+
+ obj = context.object
+ if obj.type == 'ARMATURE' and obj.mode in {'EDIT', 'POSE'} and obj.data.draw_type in {'BBONE', 'ENVELOPE'}:
+ layout.operator("transform.transform", text="Scale Envelope/BBone").mode = 'BONE_SIZE'
+
+ if context.edit_object and context.edit_object.type == 'ARMATURE':
+ layout.operator("armature.align")
+ else:
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("transform.transform", text="Align to Transform Orientation").mode = 'ALIGN' # XXX see alignmenu() in edit.c of b2.4x to get this working
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_AREA'
+
+ layout.operator("object.origin_set", text="Geometry to Origin").type = 'GEOMETRY_ORIGIN'
+ layout.operator("object.origin_set", text="Origin to Geometry").type = 'ORIGIN_GEOMETRY'
+ layout.operator("object.origin_set", text="Origin to 3D Cursor").type = 'ORIGIN_CURSOR'
+
+ if context.mode == 'OBJECT':
+ layout.operator("object.align")
+ layout.operator("object.randomize_transform")
+
+
+class VIEW3D_MT_mirror(bpy.types.Menu):
+ bl_label = "Mirror"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("transform.mirror", text="Interactive Mirror")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ props = layout.operator("transform.mirror", text="X Global")
+ props.constraint_axis = (True, False, False)
+ props.constraint_orientation = 'GLOBAL'
+ props = layout.operator("transform.mirror", text="Y Global")
+ props.constraint_axis = (False, True, False)
+ props.constraint_orientation = 'GLOBAL'
+ props = layout.operator("transform.mirror", text="Z Global")
+ props.constraint_axis = (False, False, True)
+ props.constraint_orientation = 'GLOBAL'
+
+ if context.edit_object:
+ layout.separator()
+
+ props = layout.operator("transform.mirror", text="X Local")
+ props.constraint_axis = (True, False, False)
+ props.constraint_orientation = 'LOCAL'
+ props = layout.operator("transform.mirror", text="Y Local")
+ props.constraint_axis = (False, True, False)
+ props.constraint_orientation = 'LOCAL'
+ props = layout.operator("transform.mirror", text="Z Local")
+ props.constraint_axis = (False, False, True)
+ props.constraint_orientation = 'LOCAL'
+
+ layout.operator("object.vertex_group_mirror")
+
+
+class VIEW3D_MT_snap(bpy.types.Menu):
+ bl_label = "Snap"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.snap_selected_to_grid", text="Selection to Grid")
+ layout.operator("view3d.snap_selected_to_cursor", text="Selection to Cursor")
+
+ layout.separator()
+
+ layout.operator("view3d.snap_cursor_to_selected", text="Cursor to Selected")
+ layout.operator("view3d.snap_cursor_to_center", text="Cursor to Center")
+ layout.operator("view3d.snap_cursor_to_grid", text="Cursor to Grid")
+ layout.operator("view3d.snap_cursor_to_active", text="Cursor to Active")
+
+
+class VIEW3D_MT_uv_map(bpy.types.Menu):
+ bl_label = "UV Mapping"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("uv.unwrap")
+ layout.operator("uv.cube_project")
+ layout.operator("uv.cylinder_project")
+ layout.operator("uv.sphere_project")
+ layout.operator("uv.project_from_view")
+ layout.operator("uv.project_from_view", text="Project from View (Bounds)").scale_to_bounds = True
+
+ layout.separator()
+
+ layout.operator("uv.reset")
+
+ layout.separator()
+
+ # python scripts
+ layout.operator_context = 'INVOKE_REGION_WIN'
+ layout.operator("uv.smart_project")
+ layout.operator("uv.lightmap_pack")
+ layout.operator("uv.follow_active_quads")
+
+# ********** View menus **********
+
+
+class VIEW3D_MT_view(bpy.types.Menu):
+ bl_label = "View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.properties", icon='MENU_PANEL')
+ layout.operator("view3d.toolshelf", icon='MENU_PANEL')
+
+ layout.separator()
+
+ layout.operator("view3d.viewnumpad", text="Camera").type = 'CAMERA'
+ layout.operator("view3d.viewnumpad", text="Top").type = 'TOP'
+ layout.operator("view3d.viewnumpad", text="Bottom").type = 'BOTTOM'
+ layout.operator("view3d.viewnumpad", text="Front").type = 'FRONT'
+ layout.operator("view3d.viewnumpad", text="Back").type = 'BACK'
+ layout.operator("view3d.viewnumpad", text="Right").type = 'RIGHT'
+ layout.operator("view3d.viewnumpad", text="Left").type = 'LEFT'
+
+ layout.menu("VIEW3D_MT_view_cameras", text="Cameras")
+
+ layout.separator()
+
+ layout.operator("view3d.view_persportho")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_view_navigation")
+ layout.menu("VIEW3D_MT_view_align")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("view3d.clip_border", text="Clipping Border...")
+ layout.operator("view3d.zoom_border", text="Zoom Border...")
+
+ layout.separator()
+
+ layout.operator("view3d.layers", text="Show All Layers").nr = 0
+
+ layout.separator()
+
+ layout.operator("view3d.localview", text="View Global/Local")
+ layout.operator("view3d.view_selected")
+ layout.operator("view3d.view_all")
+
+ layout.separator()
+
+ layout.operator("screen.animation_play", text="Playback Animation")
+
+ layout.separator()
+
+ layout.operator("screen.area_dupli")
+ layout.operator("screen.region_quadview")
+ layout.operator("screen.screen_full_area")
+
+
+class VIEW3D_MT_view_navigation(bpy.types.Menu):
+ bl_label = "Navigation"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_enum("view3d.view_orbit", "type")
+
+ layout.separator()
+
+ layout.operator_enum("view3d.view_pan", "type")
+
+ layout.separator()
+
+ layout.operator("view3d.zoom", text="Zoom In").delta = 1
+ layout.operator("view3d.zoom", text="Zoom Out").delta = -1
+ layout.operator("view3d.zoom_camera_1_to_1", text="Zoom Camera 1:1")
+
+ layout.separator()
+
+ layout.operator("view3d.fly")
+
+
+class VIEW3D_MT_view_align(bpy.types.Menu):
+ bl_label = "Align View"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.menu("VIEW3D_MT_view_align_selected")
+
+ layout.separator()
+
+ layout.operator("view3d.view_all", text="Center Cursor and View All").center = True
+ layout.operator("view3d.camera_to_view", text="Align Active Camera to View")
+ layout.operator("view3d.view_selected")
+ layout.operator("view3d.view_center_cursor")
+
+
+class VIEW3D_MT_view_align_selected(bpy.types.Menu):
+ bl_label = "Align View to Selected"
+
+ def draw(self, context):
+ layout = self.layout
+
+ props = layout.operator("view3d.viewnumpad", text="Top")
+ props.align_active = True
+ props.type = 'TOP'
+ props = layout.operator("view3d.viewnumpad", text="Bottom")
+ props.align_active = True
+ props.type = 'BOTTOM'
+ props = layout.operator("view3d.viewnumpad", text="Front")
+ props.align_active = True
+ props.type = 'FRONT'
+ props = layout.operator("view3d.viewnumpad", text="Back")
+ props.align_active = True
+ props.type = 'BACK'
+ props = layout.operator("view3d.viewnumpad", text="Right")
+ props.align_active = True
+ props.type = 'RIGHT'
+ props = layout.operator("view3d.viewnumpad", text="Left")
+ props.align_active = True
+ props.type = 'LEFT'
+
+
+class VIEW3D_MT_view_cameras(bpy.types.Menu):
+ bl_label = "Cameras"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.object_as_camera")
+ layout.operator("view3d.viewnumpad", text="Active Camera").type = 'CAMERA'
+
+# ********** Select menus, suffix from context.mode **********
+
+
+class VIEW3D_MT_select_object(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+ layout.operator("view3d.select_circle")
+
+ layout.separator()
+
+ layout.operator("object.select_all", text="Select/Deselect All")
+ layout.operator("object.select_inverse", text="Inverse")
+ layout.operator("object.select_random", text="Random")
+ layout.operator("object.select_mirror", text="Mirror")
+ layout.operator("object.select_by_layer", text="Select All by Layer")
+ layout.operator_menu_enum("object.select_by_type", "type", text="Select All by Type...")
+ layout.operator("object.select_camera", text="Select Camera")
+
+ layout.separator()
+
+ layout.operator_menu_enum("object.select_grouped", "type", text="Grouped")
+ layout.operator_menu_enum("object.select_linked", "type", text="Linked")
+ layout.operator("object.select_pattern", text="Select Pattern...")
+
+
+class VIEW3D_MT_select_pose(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+
+ layout.separator()
+
+ layout.operator("pose.select_all", text="Select/Deselect All")
+ layout.operator("pose.select_inverse", text="Inverse")
+ layout.operator("pose.select_flip_active", text="Flip Active")
+ layout.operator("pose.select_constraint_target", text="Constraint Target")
+ layout.operator("pose.select_linked", text="Linked")
+
+ layout.separator()
+
+ layout.operator("pose.select_hierarchy", text="Parent").direction = 'PARENT'
+ layout.operator("pose.select_hierarchy", text="Child").direction = 'CHILD'
+
+ layout.separator()
+
+ props = layout.operator("pose.select_hierarchy", text="Extend Parent")
+ props.extend = True
+ props.direction = 'PARENT'
+
+ props = layout.operator("pose.select_hierarchy", text="Extend Child")
+ props.extend = True
+ props.direction = 'CHILD'
+
+ layout.separator()
+
+ layout.operator_menu_enum("pose.select_grouped", "type", text="Grouped")
+ layout.operator("object.select_pattern", text="Select Pattern...")
+
+
+class VIEW3D_MT_select_particle(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+
+ layout.separator()
+
+ layout.operator("particle.select_all", text="Select/Deselect All")
+ layout.operator("particle.select_linked")
+ layout.operator("particle.select_inverse")
+
+ layout.separator()
+
+ layout.operator("particle.select_more")
+ layout.operator("particle.select_less")
+
+ layout.separator()
+
+ layout.operator("particle.select_roots", text="Roots")
+ layout.operator("particle.select_tips", text="Tips")
+
+
+class VIEW3D_MT_select_edit_mesh(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+ layout.operator("view3d.select_circle")
+
+ layout.separator()
+
+ layout.operator("mesh.select_all", text="Select/Deselect All")
+ layout.operator("mesh.select_inverse", text="Inverse")
+
+ layout.separator()
+
+ layout.operator("mesh.select_random", text="Random")
+ layout.operator("mesh.select_nth", text="Every N Number of Verts")
+ layout.operator("mesh.edges_select_sharp", text="Sharp Edges")
+ layout.operator("mesh.faces_select_linked_flat", text="Linked Flat Faces")
+ layout.operator("mesh.faces_select_interior", text="Interior Faces")
+ layout.operator("mesh.select_axis", text="Side of Active")
+
+ layout.separator()
+
+ layout.operator("mesh.select_by_number_vertices", text="Triangles").type = 'TRIANGLES'
+ layout.operator("mesh.select_by_number_vertices", text="Quads").type = 'QUADS'
+ if context.scene.tool_settings.mesh_select_mode[2] == False:
+ layout.operator("mesh.select_non_manifold", text="Non Manifold")
+ layout.operator("mesh.select_by_number_vertices", text="Loose Verts/Edges").type = 'OTHER'
+ layout.operator("mesh.select_similar", text="Similar")
+
+ layout.separator()
+
+ layout.operator("mesh.select_less", text="Less")
+ layout.operator("mesh.select_more", text="More")
+
+ layout.separator()
+
+ layout.operator("mesh.select_mirror", text="Mirror")
+
+ layout.operator("mesh.select_linked", text="Linked")
+ layout.operator("mesh.select_vertex_path", text="Vertex Path")
+ layout.operator("mesh.loop_multi_select", text="Edge Loop")
+ layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
+
+ layout.separator()
+
+ layout.operator("mesh.loop_to_region")
+ layout.operator("mesh.region_to_loop")
+
+
+class VIEW3D_MT_select_edit_curve(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+ layout.operator("view3d.select_circle")
+
+ layout.separator()
+
+ layout.operator("curve.select_all", text="Select/Deselect All")
+ layout.operator("curve.select_inverse")
+ layout.operator("curve.select_random")
+ layout.operator("curve.select_nth", text="Every Nth Number of Points")
+
+ layout.separator()
+
+ layout.operator("curve.de_select_first")
+ layout.operator("curve.de_select_last")
+ layout.operator("curve.select_next")
+ layout.operator("curve.select_previous")
+
+ layout.separator()
+
+ layout.operator("curve.select_more")
+ layout.operator("curve.select_less")
+
+
+class VIEW3D_MT_select_edit_surface(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+ layout.operator("view3d.select_circle")
+
+ layout.separator()
+
+ layout.operator("curve.select_all", text="Select/Deselect All")
+ layout.operator("curve.select_inverse")
+ layout.operator("curve.select_random")
+ layout.operator("curve.select_nth", text="Every Nth Number of Points")
+
+ layout.separator()
+
+ layout.operator("curve.select_row")
+
+ layout.separator()
+
+ layout.operator("curve.select_more")
+ layout.operator("curve.select_less")
+
+
+class VIEW3D_MT_select_edit_metaball(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+
+ layout.separator()
+
+ layout.operator("mball.select_all").action = 'TOGGLE'
+ layout.operator("mball.select_inverse_metaelems")
+
+ layout.separator()
+
+ layout.operator("mball.select_random_metaelems")
+
+
+class VIEW3D_MT_select_edit_lattice(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+
+ layout.separator()
+
+ layout.operator("lattice.select_all", text="Select/Deselect All")
+
+
+class VIEW3D_MT_select_edit_armature(bpy.types.Menu):
+ bl_label = "Select"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("view3d.select_border")
+
+ layout.separator()
+
+ layout.operator("armature.select_all", text="Select/Deselect All")
+ layout.operator("armature.select_inverse", text="Inverse")
+
+ layout.separator()
+
+ layout.operator("armature.select_hierarchy", text="Parent").direction = 'PARENT'
+ layout.operator("armature.select_hierarchy", text="Child").direction = 'CHILD'
+
+ layout.separator()
+
+ props = layout.operator("armature.select_hierarchy", text="Extend Parent")
+ props.extend = True
+ props.direction = 'PARENT'
+
+ props = layout.operator("armature.select_hierarchy", text="Extend Child")
+ props.extend = True
+ props.direction = 'CHILD'
+
+ layout.operator("object.select_pattern", text="Select Pattern...")
+
+
+class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum
+ bl_label = "Select"
+
+ def draw(self, context):
+ # layout = self.layout
+
+ # TODO
+ # see view3d_select_faceselmenu
+ pass
+
+# ********** Object menu **********
+
+
+class VIEW3D_MT_object(bpy.types.Menu):
+ bl_context = "objectmode"
+ bl_label = "Object"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_object_clear")
+ layout.menu("VIEW3D_MT_object_apply")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_object_animation")
+
+ layout.separator()
+
+ layout.operator("object.duplicate_move")
+ layout.operator("object.duplicate_move_linked")
+ layout.operator("object.delete", text="Delete...")
+ layout.operator("object.proxy_make", text="Make Proxy...")
+ layout.menu("VIEW3D_MT_make_links", text="Make Links...")
+ layout.operator("object.make_dupli_face")
+ layout.operator_menu_enum("object.make_local", "type", text="Make Local...")
+ layout.menu("VIEW3D_MT_make_single_user")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_object_parent")
+ layout.menu("VIEW3D_MT_object_track")
+ layout.menu("VIEW3D_MT_object_group")
+ layout.menu("VIEW3D_MT_object_constraints")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_object_game")
+
+ layout.separator()
+
+ layout.operator("object.join_uvs")
+ layout.operator("object.join")
+
+ layout.separator()
+
+ layout.operator("object.move_to_layer", text="Move to Layer...")
+ layout.menu("VIEW3D_MT_object_showhide")
+
+ layout.operator_menu_enum("object.convert", "target")
+
+
+class VIEW3D_MT_object_animation(bpy.types.Menu):
+ bl_context = "objectmode"
+ bl_label = "Animation"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
+ layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
+ layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
+
+
+class VIEW3D_MT_object_clear(bpy.types.Menu):
+ bl_label = "Clear"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.location_clear", text="Location")
+ layout.operator("object.rotation_clear", text="Rotation")
+ layout.operator("object.scale_clear", text="Scale")
+ layout.operator("object.origin_clear", text="Origin")
+
+
+class VIEW3D_MT_object_specials(bpy.types.Menu):
+ bl_label = "Specials"
+
+ @classmethod
+ def poll(cls, context):
+ # add more special types
+ return context.object
+
+ def draw(self, context):
+ layout = self.layout
+
+ obj = context.object
+ if obj.type == 'CAMERA':
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ props = layout.operator("wm.context_modal_mouse", text="Camera Lens Angle")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.lens"
+ props.input_scale = 0.1
+
+ if not obj.data.dof_object:
+ #layout.label(text="Test Has DOF obj");
+ props = layout.operator("wm.context_modal_mouse", text="DOF Distance")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.dof_distance"
+ props.input_scale = 0.02
+
+ if obj.type in {'CURVE', 'FONT'}:
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ props = layout.operator("wm.context_modal_mouse", text="Extrude Size")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.extrude"
+ props.input_scale = 0.01
+
+ props = layout.operator("wm.context_modal_mouse", text="Width Size")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.offset"
+ props.input_scale = 0.01
+
+ if obj.type == 'EMPTY':
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ props = layout.operator("wm.context_modal_mouse", text="Empty Draw Size")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "empty_draw_size"
+ props.input_scale = 0.01
+
+ if obj.type == 'LAMP':
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ props = layout.operator("wm.context_modal_mouse", text="Energy")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.energy"
+
+ if obj.data.type in {'SPOT', 'AREA', 'POINT'}:
+ props = layout.operator("wm.context_modal_mouse", text="Falloff Distance")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.distance"
+ props.input_scale = 0.1
+
+ if obj.data.type == 'SPOT':
+ layout.separator()
+ props = layout.operator("wm.context_modal_mouse", text="Spot Size")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.spot_size"
+ props.input_scale = 0.01
+
+ props = layout.operator("wm.context_modal_mouse", text="Spot Blend")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.spot_blend"
+ props.input_scale = -0.01
+
+ props = layout.operator("wm.context_modal_mouse", text="Clip Start")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.shadow_buffer_clip_start"
+ props.input_scale = 0.05
+
+ props = layout.operator("wm.context_modal_mouse", text="Clip End")
+ props.data_path_iter = "selected_editable_objects"
+ props.data_path_item = "data.shadow_buffer_clip_end"
+ props.input_scale = 0.05
+
+ layout.separator()
+
+ props = layout.operator("object.isolate_type_render")
+ props = layout.operator("object.hide_render_clear_all")
+
+
+class VIEW3D_MT_object_apply(bpy.types.Menu):
+ bl_label = "Apply"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.location_apply", text="Location")
+ layout.operator("object.rotation_apply", text="Rotation")
+ layout.operator("object.scale_apply", text="Scale")
+ layout.separator()
+ layout.operator("object.visual_transform_apply", text="Visual Transform")
+ layout.operator("object.duplicates_make_real")
+
+
+class VIEW3D_MT_object_parent(bpy.types.Menu):
+ bl_label = "Parent"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.parent_set", text="Set")
+ layout.operator("object.parent_clear", text="Clear")
+
+
+class VIEW3D_MT_object_track(bpy.types.Menu):
+ bl_label = "Track"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.track_set", text="Set")
+ layout.operator("object.track_clear", text="Clear")
+
+
+class VIEW3D_MT_object_group(bpy.types.Menu):
+ bl_label = "Group"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("group.create")
+ layout.operator("group.objects_remove")
+
+ layout.separator()
+
+ layout.operator("group.objects_add_active")
+ layout.operator("group.objects_remove_active")
+
+
+class VIEW3D_MT_object_constraints(bpy.types.Menu):
+ bl_label = "Constraints"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.constraint_add_with_targets")
+ layout.operator("object.constraints_copy")
+ layout.operator("object.constraints_clear")
+
+
+class VIEW3D_MT_object_showhide(bpy.types.Menu):
+ bl_label = "Show/Hide"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.hide_view_clear", text="Show Hidden")
+ layout.operator("object.hide_view_set", text="Hide Selected")
+ layout.operator("object.hide_view_set", text="Hide Unselected").unselected = True
+
+
+class VIEW3D_MT_make_single_user(bpy.types.Menu):
+ bl_label = "Make Single User"
+
+ def draw(self, context):
+ layout = self.layout
+
+ props = layout.operator("object.make_single_user", text="Object")
+ props.object = True
+
+ props = layout.operator("object.make_single_user", text="Object & Data")
+ props.object = props.obdata = True
+
+ props = layout.operator("object.make_single_user", text="Object & Data & Materials+Tex")
+ props.object = props.obdata = props.material = props.texture = True
+
+ props = layout.operator("object.make_single_user", text="Materials+Tex")
+ props.material = props.texture = True
+
+ props = layout.operator("object.make_single_user", text="Object Animation")
+ props.animation = True
+
+
+class VIEW3D_MT_make_links(bpy.types.Menu):
+ bl_label = "Make Links"
+
+ def draw(self, context):
+ layout = self.layout
+
+ if(len(bpy.data.scenes) > 10):
+ layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator("object.make_links_scene", text="Objects to Scene...", icon='OUTLINER_OB_EMPTY')
+ layout.operator("object.make_links_scene", text="Markers to Scene...", icon='OUTLINER_OB_EMPTY')
+ else:
+ layout.operator_menu_enum("object.make_links_scene", "scene", text="Objects to Scene...")
+ layout.operator_menu_enum("marker.make_links_scene", "scene", text="Markers to Scene...")
+
+ layout.operator_enum("object.make_links_data", "type") # inline
+
+
+class VIEW3D_MT_object_game(bpy.types.Menu):
+ bl_label = "Game"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("object.logic_bricks_copy", text="Copy Logic Bricks")
+
+ layout.separator()
+
+ layout.operator("object.game_property_copy", text="Replace Properties").operation = 'REPLACE'
+ layout.operator("object.game_property_copy", text="Merge Properties").operation = 'MERGE'
+ layout.operator_menu_enum("object.game_property_copy", "property", text="Copy Properties...")
+
+ layout.separator()
+
+ layout.operator("object.game_property_clear")
+
+
+# ********** Vertex paint menu **********
+
+
+class VIEW3D_MT_paint_vertex(bpy.types.Menu):
+ bl_label = "Paint"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.operator("paint.vertex_color_set")
+ layout.operator("paint.vertex_color_dirt")
+
+
+class VIEW3D_MT_hook(bpy.types.Menu):
+ bl_label = "Hooks"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("object.hook_add_newob")
+ layout.operator("object.hook_add_selob")
+
+ if [mod.type == 'HOOK' for mod in context.active_object.modifiers]:
+ layout.separator()
+ layout.operator_menu_enum("object.hook_assign", "modifier")
+ layout.operator_menu_enum("object.hook_remove", "modifier")
+ layout.separator()
+ layout.operator_menu_enum("object.hook_select", "modifier")
+ layout.operator_menu_enum("object.hook_reset", "modifier")
+ layout.operator_menu_enum("object.hook_recenter", "modifier")
+
+
+class VIEW3D_MT_vertex_group(bpy.types.Menu):
+ bl_label = "Vertex Groups"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("object.vertex_group_assign", text="Assign to New Group").new = True
+
+ ob = context.active_object
+ if ob.mode == 'EDIT':
+ if ob.vertex_groups.active:
+ layout.separator()
+ layout.operator("object.vertex_group_assign", text="Assign to Active Group")
+ layout.operator("object.vertex_group_remove_from", text="Remove from Active Group")
+ layout.operator("object.vertex_group_remove_from", text="Remove from All").all = True
+ layout.separator()
+
+ if ob.vertex_groups.active:
+ layout.operator_menu_enum("object.vertex_group_set_active", "group", text="Set Active Group")
+ layout.operator("object.vertex_group_remove", text="Remove Active Group")
+ layout.operator("object.vertex_group_remove", text="Remove All Groups").all = True
+
+# ********** Weight paint menu **********
+
+
+class VIEW3D_MT_paint_weight(bpy.types.Menu):
+ bl_label = "Weights"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.operator("paint.weight_from_bones", text="Assign Automatic From Bones").type = 'AUTOMATIC'
+ layout.operator("paint.weight_from_bones", text="Assign From Bone Envelopes").type = 'ENVELOPES'
+
+ layout.separator()
+
+ layout.operator("object.vertex_group_normalize_all", text="Normalize All")
+ layout.operator("object.vertex_group_normalize", text="Normalize")
+ layout.operator("object.vertex_group_invert", text="Invert")
+ layout.operator("object.vertex_group_clean", text="Clean")
+ layout.operator("object.vertex_group_levels", text="Levels")
+
+# ********** Sculpt menu **********
+
+
+class VIEW3D_MT_sculpt(bpy.types.Menu):
+ bl_label = "Sculpt"
+
+ def draw(self, context):
+ layout = self.layout
+
+ tool_settings = context.tool_settings
+ sculpt = tool_settings.sculpt
+ brush = tool_settings.sculpt.brush
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.prop(sculpt, "use_symmetry_x")
+ layout.prop(sculpt, "use_symmetry_y")
+ layout.prop(sculpt, "use_symmetry_z")
+ layout.separator()
+ layout.prop(sculpt, "lock_x")
+ layout.prop(sculpt, "lock_y")
+ layout.prop(sculpt, "lock_z")
+ layout.separator()
+ layout.operator_menu_enum("brush.curve_preset", "shape")
+ layout.separator()
+
+ sculpt_tool = brush.sculpt_tool
+
+ if sculpt_tool != 'GRAB':
+ layout.prop_menu_enum(brush, "stroke_method")
+
+ if sculpt_tool in {'DRAW', 'PINCH', 'INFLATE', 'LAYER', 'CLAY'}:
+ layout.prop_menu_enum(brush, "direction")
+
+ if sculpt_tool == 'LAYER':
+ layout.prop(brush, "use_persistent")
+ layout.operator("sculpt.set_persistent_base")
+
+ layout.separator()
+ layout.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+ layout.prop(sculpt, "show_brush")
+
+ # TODO, make availabel from paint menu!
+ layout.prop(tool_settings, "sculpt_paint_use_unified_size", text="Unify Size")
+ layout.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Unify Strength")
+
+# ********** Particle menu **********
+
+
+class VIEW3D_MT_particle(bpy.types.Menu):
+ bl_label = "Particle"
+
+ def draw(self, context):
+ layout = self.layout
+
+ particle_edit = context.tool_settings.particle_edit
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.operator("particle.mirror")
+
+ layout.separator()
+
+ layout.operator("particle.remove_doubles")
+ layout.operator("particle.delete")
+
+ if particle_edit.select_mode == 'POINT':
+ layout.operator("particle.subdivide")
+
+ layout.operator("particle.rekey")
+ layout.operator("particle.weight_set")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_particle_showhide")
+
+
+class VIEW3D_MT_particle_specials(bpy.types.Menu):
+ bl_label = "Specials"
+
+ def draw(self, context):
+ layout = self.layout
+ particle_edit = context.tool_settings.particle_edit
+
+ layout.operator("particle.rekey")
+
+ layout.separator()
+ if particle_edit.select_mode == 'POINT':
+ layout.operator("particle.subdivide")
+ layout.operator("particle.select_roots")
+ layout.operator("particle.select_tips")
+
+ layout.operator("particle.remove_doubles")
+
+
+class VIEW3D_MT_particle_showhide(ShowHideMenu, bpy.types.Menu):
+ _operator_name = "particle"
+
+# ********** Pose Menu **********
+
+
+class VIEW3D_MT_pose(bpy.types.Menu):
+ bl_label = "Pose"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.menu("VIEW3D_MT_pose_transform")
+
+ layout.separator()
+
+ layout.operator("anim.keyframe_insert_menu", text="Insert Keyframe...")
+ layout.operator("anim.keyframe_delete_v3d", text="Delete Keyframe...")
+ layout.operator("anim.keying_set_active_set", text="Change Keying Set...")
+
+ layout.separator()
+
+ layout.operator("pose.relax")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_pose_apply")
+
+ layout.separator()
+
+ layout.operator("pose.copy")
+ layout.operator("pose.paste")
+ layout.operator("pose.paste", text="Paste X-Flipped Pose").flipped = True
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_pose_pose")
+ layout.menu("VIEW3D_MT_pose_motion")
+ layout.menu("VIEW3D_MT_pose_group")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_object_parent")
+ layout.menu("VIEW3D_MT_pose_ik")
+ layout.menu("VIEW3D_MT_pose_constraints")
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("pose.autoside_names", text="AutoName Left/Right").axis = 'XAXIS'
+ layout.operator("pose.autoside_names", text="AutoName Front/Back").axis = 'YAXIS'
+ layout.operator("pose.autoside_names", text="AutoName Top/Bottom").axis = 'ZAXIS'
+
+ layout.operator("pose.flip_names")
+
+ layout.operator("pose.quaternions_flip")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_AREA'
+ layout.operator("pose.armature_layers", text="Change Armature Layers...")
+ layout.operator("pose.bone_layers", text="Change Bone Layers...")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_pose_showhide")
+ layout.operator_menu_enum("pose.flags_set", 'mode', text="Bone Settings")
+
+
+class VIEW3D_MT_pose_transform(bpy.types.Menu):
+ bl_label = "Clear Transform"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("pose.transforms_clear", text="All")
+
+ layout.operator("pose.loc_clear", text="Location")
+ layout.operator("pose.rot_clear", text="Rotation")
+ layout.operator("pose.scale_clear", text="Scale")
+
+ layout.label(text="Origin")
+
+
+class VIEW3D_MT_pose_pose(bpy.types.Menu):
+ bl_label = "Pose Library"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("poselib.browse_interactive", text="Browse Poses...")
+
+ layout.separator()
+
+ layout.operator("poselib.pose_add", text="Add Pose...")
+ layout.operator("poselib.pose_rename", text="Rename Pose...")
+ layout.operator("poselib.pose_remove", text="Remove Pose...")
+
+
+class VIEW3D_MT_pose_motion(bpy.types.Menu):
+ bl_label = "Motion Paths"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("pose.paths_calculate", text="Calculate")
+ layout.operator("pose.paths_clear", text="Clear")
+
+
+class VIEW3D_MT_pose_group(bpy.types.Menu):
+ bl_label = "Bone Groups"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator("pose.group_add")
+ layout.operator("pose.group_remove")
+
+ layout.separator()
+
+ layout.operator("pose.group_assign")
+ layout.operator("pose.group_unassign")
+
+
+class VIEW3D_MT_pose_ik(bpy.types.Menu):
+ bl_label = "Inverse Kinematics"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("pose.ik_add")
+ layout.operator("pose.ik_clear")
+
+
+class VIEW3D_MT_pose_constraints(bpy.types.Menu):
+ bl_label = "Constraints"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("pose.constraint_add_with_targets", text="Add (With Targets)...")
+ layout.operator("pose.constraints_copy")
+ layout.operator("pose.constraints_clear")
+
+
+class VIEW3D_MT_pose_showhide(ShowHideMenu, bpy.types.Menu):
+ _operator_name = "pose"
+
+
+class VIEW3D_MT_pose_apply(bpy.types.Menu):
+ bl_label = "Apply"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("pose.armature_apply")
+ layout.operator("pose.visual_transform_apply")
+
+
+# ********** Edit Menus, suffix from ob.type **********
+
+
+class VIEW3D_MT_edit_mesh(bpy.types.Menu):
+ bl_label = "Mesh"
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_uv_map", text="UV Unwrap...")
+
+ layout.separator()
+
+ layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
+ layout.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
+ layout.operator("mesh.duplicate_move")
+ layout.operator("mesh.delete", text="Delete...")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_mesh_vertices")
+ layout.menu("VIEW3D_MT_edit_mesh_edges")
+ layout.menu("VIEW3D_MT_edit_mesh_faces")
+ layout.menu("VIEW3D_MT_edit_mesh_normals")
+
+ layout.separator()
+
+ layout.prop(settings, "use_mesh_automerge")
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_mesh_showhide")
+
+
+class VIEW3D_MT_edit_mesh_specials(bpy.types.Menu):
+ bl_label = "Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("mesh.subdivide", text="Subdivide")
+ layout.operator("mesh.subdivide", text="Subdivide Smooth").smoothness = 1.0
+ layout.operator("mesh.merge", text="Merge...")
+ layout.operator("mesh.remove_doubles")
+ layout.operator("mesh.hide", text="Hide")
+ layout.operator("mesh.reveal", text="Reveal")
+ layout.operator("mesh.select_inverse")
+ layout.operator("mesh.flip_normals")
+ layout.operator("mesh.vertices_smooth", text="Smooth")
+ # layout.operator("mesh.bevel", text="Bevel")
+ layout.operator("mesh.faces_shade_smooth")
+ layout.operator("mesh.faces_shade_flat")
+ layout.operator("mesh.blend_from_shape")
+ layout.operator("mesh.shape_propagate_to_all")
+ layout.operator("mesh.select_vertex_path")
+
+
+class VIEW3D_MT_edit_mesh_select_mode(bpy.types.Menu):
+ bl_label = "Mesh Select Mode"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ prop = layout.operator("wm.context_set_value", text="Vertex", icon='VERTEXSEL')
+ prop.value = "(True, False, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Edge", icon='EDGESEL')
+ prop.value = "(False, True, False)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+ prop = layout.operator("wm.context_set_value", text="Face", icon='FACESEL')
+ prop.value = "(False, False, True)"
+ prop.data_path = "tool_settings.mesh_select_mode"
+
+
+class VIEW3D_MT_edit_mesh_extrude(bpy.types.Menu):
+ bl_label = "Extrude"
+
+ _extrude_funcs = { \
+ "VERT": lambda layout: layout.operator("mesh.extrude_vertices_move", text="Vertices Only"),
+ "EDGE": lambda layout: layout.operator("mesh.extrude_edges_move", text="Edges Only"),
+ "FACE": lambda layout: layout.operator("mesh.extrude_faces_move", text="Individual Faces"),
+ "REGION": lambda layout: layout.operator("view3d.edit_mesh_extrude_move_normal", text="Region"),
+ }
+
+ @staticmethod
+ def extrude_options(context):
+ mesh = context.object.data
+ select_mode = context.tool_settings.mesh_select_mode
+
+ menu = []
+ if mesh.total_face_sel:
+ menu += ["REGION", "FACE"]
+ if mesh.total_edge_sel and (select_mode[0] or select_mode[1]):
+ menu += ["EDGE"]
+ if mesh.total_vert_sel and select_mode[0]:
+ menu += ["VERT"]
+
+ # should never get here
+ return menu
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ for menu_id in self.extrude_options(context):
+ self._extrude_funcs[menu_id](layout)
+
+
+class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
+ "Extrude individual elements and move"
+ bl_label = "Extrude Individual and Move"
+ bl_idname = "view3d.edit_mesh_extrude_individual_move"
+
+ def execute(self, context):
+ mesh = context.object.data
+ select_mode = context.tool_settings.mesh_select_mode
+
+ totface = mesh.total_face_sel
+ totedge = mesh.total_edge_sel
+ # totvert = mesh.total_vert_sel
+
+ if select_mode[2] and totface == 1:
+ bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
+ elif select_mode[2] and totface > 1:
+ bpy.ops.mesh.extrude_faces_move('INVOKE_REGION_WIN')
+ elif select_mode[1] and totedge >= 1:
+ bpy.ops.mesh.extrude_edges_move('INVOKE_REGION_WIN')
+ else:
+ bpy.ops.mesh.extrude_vertices_move('INVOKE_REGION_WIN')
+
+ # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ return self.execute(context)
+
+
+class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
+ "Extrude and move along normals"
+ bl_label = "Extrude and Move on Normals"
+ bl_idname = "view3d.edit_mesh_extrude_move_normal"
+
+ def execute(self, context):
+ mesh = context.object.data
+
+ totface = mesh.total_face_sel
+ totedge = mesh.total_edge_sel
+ # totvert = mesh.total_vert_sel
+
+ if totface >= 1:
+ bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
+ elif totedge == 1:
+ bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (True, True, False)})
+ else:
+ bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN')
+
+ # ignore return from operators above because they are 'RUNNING_MODAL', and cause this one not to be freed. [#24671]
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ return self.execute(context)
+
+
+class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu):
+ bl_label = "Vertices"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("mesh.merge")
+ layout.operator("mesh.rip_move")
+ layout.operator("mesh.split")
+ layout.operator("mesh.separate")
+
+ layout.separator()
+
+ layout.operator("mesh.vertices_smooth")
+ layout.operator("mesh.remove_doubles")
+ layout.operator("mesh.vertices_sort")
+ layout.operator("mesh.vertices_randomize")
+
+ layout.operator("mesh.select_vertex_path")
+
+ layout.operator("mesh.blend_from_shape")
+
+ layout.operator("object.vertex_group_blend")
+ layout.operator("mesh.shape_propagate_to_all")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_vertex_group")
+ layout.menu("VIEW3D_MT_hook")
+
+
+class VIEW3D_MT_edit_mesh_edges(bpy.types.Menu):
+ bl_label = "Edges"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("mesh.edge_face_add")
+ layout.operator("mesh.subdivide")
+
+ layout.separator()
+
+ layout.operator("mesh.mark_seam")
+ layout.operator("mesh.mark_seam", text="Clear Seam").clear = True
+
+ layout.separator()
+
+ layout.operator("mesh.mark_sharp")
+ layout.operator("mesh.mark_sharp", text="Clear Sharp").clear = True
+
+ layout.separator()
+
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CCW").direction = 'CCW'
+
+ layout.separator()
+
+ layout.operator("TRANSFORM_OT_edge_slide")
+ layout.operator("TRANSFORM_OT_edge_crease")
+ layout.operator("mesh.loop_multi_select", text="Edge Loop")
+
+ # uiItemO(layout, "Loopcut", 0, "mesh.loop_cut"); // CutEdgeloop(em, 1);
+ # uiItemO(layout, "Edge Slide", 0, "mesh.edge_slide"); // EdgeSlide(em, 0,0.0);
+
+ layout.operator("mesh.loop_multi_select", text="Edge Ring").ring = True
+
+ layout.operator("mesh.loop_to_region")
+ layout.operator("mesh.region_to_loop")
+
+
+class VIEW3D_MT_edit_mesh_faces(bpy.types.Menu):
+ bl_label = "Faces"
+ bl_idname = "VIEW3D_MT_edit_mesh_faces"
+
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("mesh.flip_normals")
+ # layout.operator("mesh.bevel")
+ # layout.operator("mesh.bevel")
+ layout.operator("mesh.edge_face_add")
+ layout.operator("mesh.fill")
+ layout.operator("mesh.beautify_fill")
+ layout.operator("mesh.solidify")
+ layout.operator("mesh.sort_faces")
+
+ layout.separator()
+
+ layout.operator("mesh.fgon_make")
+ layout.operator("mesh.fgon_clear")
+
+ layout.separator()
+
+ layout.operator("mesh.quads_convert_to_tris")
+ layout.operator("mesh.tris_convert_to_quads")
+ layout.operator("mesh.edge_flip")
+
+ layout.separator()
+
+ layout.operator("mesh.faces_shade_smooth")
+ layout.operator("mesh.faces_shade_flat")
+
+ layout.separator()
+
+ # uiItemO(layout, NULL, 0, "mesh.face_mode"); // mesh_set_face_flags(em, 1);
+ # uiItemBooleanO(layout, NULL, 0, "mesh.face_mode", "clear", 1); // mesh_set_face_flags(em, 0);
+
+ layout.operator("mesh.edge_rotate", text="Rotate Edge CW").direction = 'CW'
+
+ layout.separator()
+
+ layout.operator_menu_enum("mesh.uvs_rotate", "direction")
+ layout.operator_menu_enum("mesh.uvs_mirror", "axis")
+ layout.operator_menu_enum("mesh.colors_rotate", "direction")
+ layout.operator_menu_enum("mesh.colors_mirror", "axis")
+
+
+class VIEW3D_MT_edit_mesh_normals(bpy.types.Menu):
+ bl_label = "Normals"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("mesh.normals_make_consistent", text="Recalculate Outside")
+ layout.operator("mesh.normals_make_consistent", text="Recalculate Inside").inside = True
+
+ layout.separator()
+
+ layout.operator("mesh.flip_normals")
+
+
+class VIEW3D_MT_edit_mesh_showhide(ShowHideMenu, bpy.types.Menu):
+ _operator_name = "mesh"
+
+# Edit Curve
+# draw_curve is used by VIEW3D_MT_edit_curve and VIEW3D_MT_edit_surface
+
+
+def draw_curve(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.separator()
+
+ layout.operator("curve.extrude")
+ layout.operator("curve.duplicate")
+ layout.operator("curve.separate")
+ layout.operator("curve.make_segment")
+ layout.operator("curve.cyclic_toggle")
+ layout.operator("curve.delete", text="Delete...")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_curve_ctrlpoints")
+ layout.menu("VIEW3D_MT_edit_curve_segments")
+
+ layout.separator()
+
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_curve_showhide")
+
+
+class VIEW3D_MT_edit_curve(bpy.types.Menu):
+ bl_label = "Curve"
+
+ draw = draw_curve
+
+
+class VIEW3D_MT_edit_curve_ctrlpoints(bpy.types.Menu):
+ bl_label = "Control Points"
+
+ def draw(self, context):
+ layout = self.layout
+
+ edit_object = context.edit_object
+
+ if edit_object.type == 'CURVE':
+ layout.operator("transform.transform", text="Tilt").mode = 'TILT'
+ layout.operator("curve.tilt_clear")
+ layout.operator("curve.separate")
+
+ layout.separator()
+
+ layout.operator_menu_enum("curve.handle_type_set", "type")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_hook")
+
+
+class VIEW3D_MT_edit_curve_segments(bpy.types.Menu):
+ bl_label = "Segments"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("curve.subdivide")
+ layout.operator("curve.switch_direction")
+
+
+class VIEW3D_MT_edit_curve_specials(bpy.types.Menu):
+ bl_label = "Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("curve.subdivide")
+ layout.operator("curve.switch_direction")
+ layout.operator("curve.spline_weight_set")
+ layout.operator("curve.radius_set")
+ layout.operator("curve.smooth")
+ layout.operator("curve.smooth_radius")
+
+
+class VIEW3D_MT_edit_curve_showhide(ShowHideMenu, bpy.types.Menu):
+ _operator_name = "curve"
+
+
+class VIEW3D_MT_edit_surface(bpy.types.Menu):
+ bl_label = "Surface"
+
+ draw = draw_curve
+
+
+class VIEW3D_MT_edit_font(bpy.types.Menu):
+ bl_label = "Text"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("font.file_paste")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_text_chars")
+
+ layout.separator()
+
+ layout.operator("font.style_toggle", text="Toggle Bold").style = 'BOLD'
+ layout.operator("font.style_toggle", text="Toggle Italic").style = 'ITALIC'
+ layout.operator("font.style_toggle", text="Toggle Underline").style = 'UNDERLINE'
+ layout.operator("font.style_toggle", text="Toggle Small Caps").style = 'SMALL_CAPS'
+
+
+class VIEW3D_MT_edit_text_chars(bpy.types.Menu):
+ bl_label = "Special Characters"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("font.text_insert", text="Copyright|Alt C").text = b'\xC2\xA9'.decode()
+ layout.operator("font.text_insert", text="Registered Trademark|Alt R").text = b'\xC2\xAE'.decode()
+
+ layout.separator()
+
+ layout.operator("font.text_insert", text="Degree Sign|Alt G").text = b'\xC2\xB0'.decode()
+ layout.operator("font.text_insert", text="Multiplication Sign|Alt x").text = b'\xC3\x97'.decode()
+ layout.operator("font.text_insert", text="Circle|Alt .").text = b'\xC2\x8A'.decode()
+ layout.operator("font.text_insert", text="Superscript 1|Alt 1").text = b'\xC2\xB9'.decode()
+ layout.operator("font.text_insert", text="Superscript 2|Alt 2").text = b'\xC2\xB2'.decode()
+ layout.operator("font.text_insert", text="Superscript 3|Alt 3").text = b'\xC2\xB3'.decode()
+ layout.operator("font.text_insert", text="Double >>|Alt >").text = b'\xC2\xBB'.decode()
+ layout.operator("font.text_insert", text="Double <<|Alt <").text = b'\xC2\xAB'.decode()
+ layout.operator("font.text_insert", text="Promillage|Alt %").text = b'\xE2\x80\xB0'.decode()
+
+ layout.separator()
+
+ layout.operator("font.text_insert", text="Dutch Florin|Alt F").text = b'\xC2\xA4'.decode()
+ layout.operator("font.text_insert", text="British Pound|Alt L").text = b'\xC2\xA3'.decode()
+ layout.operator("font.text_insert", text="Japanese Yen|Alt Y").text = b'\xC2\xA5'.decode()
+
+ layout.separator()
+
+ layout.operator("font.text_insert", text="German S|Alt S").text = b'\xC3\x9F'.decode()
+ layout.operator("font.text_insert", text="Spanish Question Mark|Alt ?").text = b'\xC2\xBF'.decode()
+ layout.operator("font.text_insert", text="Spanish Exclamation Mark|Alt !").text = b'\xC2\xA1'.decode()
+
+
+class VIEW3D_MT_edit_meta(bpy.types.Menu):
+ bl_label = "Metaball"
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings
+
+ layout.operator("ed.undo")
+ layout.operator("ed.redo")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.separator()
+
+ layout.operator("mball.delete_metaelems", text="Delete...")
+ layout.operator("mball.duplicate_metaelems")
+
+ layout.separator()
+
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_meta_showhide")
+
+
+class VIEW3D_MT_edit_meta_showhide(bpy.types.Menu):
+ bl_label = "Show/Hide"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("mball.reveal_metaelems", text="Show Hidden")
+ layout.operator("mball.hide_metaelems", text="Hide Selected")
+ layout.operator("mball.hide_metaelems", text="Hide Unselected").unselected = True
+
+
+class VIEW3D_MT_edit_lattice(bpy.types.Menu):
+ bl_label = "Lattice"
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = context.tool_settings
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_snap")
+
+ layout.separator()
+
+ layout.operator("lattice.make_regular")
+
+ layout.separator()
+
+ layout.prop_menu_enum(settings, "proportional_edit")
+ layout.prop_menu_enum(settings, "proportional_edit_falloff")
+
+
+class VIEW3D_MT_edit_armature(bpy.types.Menu):
+ bl_label = "Armature"
+
+ def draw(self, context):
+ layout = self.layout
+
+ edit_object = context.edit_object
+ arm = edit_object.data
+
+ layout.menu("VIEW3D_MT_transform")
+ layout.menu("VIEW3D_MT_mirror")
+ layout.menu("VIEW3D_MT_snap")
+ layout.menu("VIEW3D_MT_edit_armature_roll")
+
+ layout.separator()
+
+ layout.operator("armature.extrude_move")
+
+ if arm.use_mirror_x:
+ layout.operator("armature.extrude_forked")
+
+ layout.operator("armature.duplicate_move")
+ layout.operator("armature.merge")
+ layout.operator("armature.fill")
+ layout.operator("armature.delete")
+ layout.operator("armature.separate")
+
+ layout.separator()
+
+ layout.operator("armature.subdivide", text="Subdivide")
+ layout.operator("armature.switch_direction", text="Switch Direction")
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_AREA'
+ layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
+ layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
+ layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
+ layout.operator("armature.flip_names")
+
+ layout.separator()
+
+ layout.operator_context = 'INVOKE_DEFAULT'
+ layout.operator("armature.armature_layers")
+ layout.operator("armature.bone_layers")
+
+ layout.separator()
+
+ layout.menu("VIEW3D_MT_edit_armature_parent")
+
+ layout.separator()
+
+ layout.operator_menu_enum("armature.flags_set", "mode", text="Bone Settings")
+
+
+class VIEW3D_MT_armature_specials(bpy.types.Menu):
+ bl_label = "Specials"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_context = 'INVOKE_REGION_WIN'
+
+ layout.operator("armature.subdivide", text="Subdivide")
+ layout.operator("armature.switch_direction", text="Switch Direction")
+
+ layout.separator()
+
+ layout.operator_context = 'EXEC_REGION_WIN'
+ layout.operator("armature.autoside_names", text="AutoName Left/Right").type = 'XAXIS'
+ layout.operator("armature.autoside_names", text="AutoName Front/Back").type = 'YAXIS'
+ layout.operator("armature.autoside_names", text="AutoName Top/Bottom").type = 'ZAXIS'
+ layout.operator("armature.flip_names", text="Flip Names")
+
+
+class VIEW3D_MT_edit_armature_parent(bpy.types.Menu):
+ bl_label = "Parent"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator("armature.parent_set", text="Make")
+ layout.operator("armature.parent_clear", text="Clear")
+
+
+class VIEW3D_MT_edit_armature_roll(bpy.types.Menu):
+ bl_label = "Bone Roll"
+
+ def draw(self, context):
+ layout = self.layout
+
+ layout.operator_menu_enum("armature.calculate_roll", "type")
+
+ layout.separator()
+
+ layout.operator("transform.transform", text="Set Roll").mode = 'BONE_ROLL'
+
+# ********** Panel **********
+
+
+class VIEW3D_PT_view3d_properties(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "View"
+
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ return (view)
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+
+ col = layout.column()
+ col.active = view.region_3d.view_perspective != 'CAMERA'
+ col.prop(view, "lens")
+ col.label(text="Lock to Object:")
+ col.prop(view, "lock_object", text="")
+ if view.lock_object and view.lock_object.type == 'ARMATURE':
+ col.prop_search(view, "lock_bone", view.lock_object.data, "bones", text="")
+ elif not view.lock_object:
+ col.prop(view, "lock_cursor", text="Lock to Cursor")
+
+ col = layout.column(align=True)
+ col.label(text="Clip:")
+ col.prop(view, "clip_start", text="Start")
+ col.prop(view, "clip_end", text="End")
+
+ subcol = col.column()
+ subcol.enabled = not view.lock_camera_and_layers
+ subcol.label(text="Local Camera:")
+ subcol.prop(view, "camera", text="")
+
+ layout.column().prop(view, "cursor_location")
+
+
+class VIEW3D_PT_view3d_name(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Item"
+
+ @classmethod
+ def poll(cls, context):
+ return (context.space_data and context.active_object)
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.active_object
+ row = layout.row()
+ row.label(text="", icon='OBJECT_DATA')
+ row.prop(ob, "name", text="")
+
+ if ob.type == 'ARMATURE' and ob.mode in {'EDIT', 'POSE'}:
+ bone = context.active_bone
+ if bone:
+ row = layout.row()
+ row.label(text="", icon='BONE_DATA')
+ row.prop(bone, "name", text="")
+
+
+class VIEW3D_PT_view3d_display(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Display"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ return (view)
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+ scene = context.scene
+ gs = scene.game_settings
+ ob = context.object
+
+ col = layout.column()
+ col.prop(view, "show_only_render")
+
+ col = layout.column()
+ display_all = not view.show_only_render
+ col.active = display_all
+ col.prop(view, "show_outline_selected")
+ col.prop(view, "show_all_objects_origin")
+ col.prop(view, "show_relationship_lines")
+ if ob and ob.type == 'MESH':
+ mesh = ob.data
+ col.prop(mesh, "show_all_edges")
+
+ col = layout.column()
+ col.active = display_all
+ split = col.split(percentage=0.55)
+ split.prop(view, "show_floor", text="Grid Floor")
+
+ row = split.row(align=True)
+ row.prop(view, "show_axis_x", text="X", toggle=True)
+ row.prop(view, "show_axis_y", text="Y", toggle=True)
+ row.prop(view, "show_axis_z", text="Z", toggle=True)
+
+ sub = col.column(align=True)
+ sub.active = (display_all and view.show_floor)
+ sub.prop(view, "grid_lines", text="Lines")
+ sub.prop(view, "grid_scale", text="Scale")
+ subsub = sub.column(align=True)
+ subsub.active = scene.unit_settings.system == 'NONE'
+ subsub.prop(view, "grid_subdivisions", text="Subdivisions")
+
+ col = layout.column()
+ col.label(text="Shading:")
+ col.prop(gs, "material_mode", text="")
+ col.prop(view, "show_textured_solid")
+
+ layout.separator()
+
+ region = view.region_quadview
+
+ layout.operator("screen.region_quadview", text="Toggle Quad View")
+
+ if region:
+ col = layout.column()
+ col.prop(region, "lock_rotation")
+ row = col.row()
+ row.enabled = region.lock_rotation
+ row.prop(region, "show_sync_view")
+ row = col.row()
+ row.enabled = region.lock_rotation and region.show_sync_view
+ row.prop(region, "use_box_clip")
+
+
+class VIEW3D_PT_view3d_meshdisplay(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Mesh Display"
+
+ @classmethod
+ def poll(cls, context):
+ # The active object check is needed because of localmode
+ return (context.active_object and (context.mode == 'EDIT_MESH'))
+
+ def draw(self, context):
+ layout = self.layout
+
+ mesh = context.active_object.data
+
+ col = layout.column()
+ col.label(text="Overlays:")
+ col.prop(mesh, "show_edges", text="Edges")
+ col.prop(mesh, "show_faces", text="Faces")
+ col.prop(mesh, "show_edge_crease", text="Creases")
+ col.prop(mesh, "show_edge_bevel_weight", text="Bevel Weights")
+ col.prop(mesh, "show_edge_seams", text="Seams")
+ col.prop(mesh, "show_edge_sharp", text="Sharp")
+
+ col.separator()
+ col.label(text="Normals:")
+ col.prop(mesh, "show_normal_face", text="Face")
+ col.prop(mesh, "show_normal_vertex", text="Vertex")
+ col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
+
+ col.separator()
+ col.label(text="Numerics:")
+ col.prop(mesh, "show_extra_edge_length")
+ col.prop(mesh, "show_extra_face_angle")
+ col.prop(mesh, "show_extra_face_area")
+
+
+class VIEW3D_PT_view3d_curvedisplay(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Curve Display"
+
+ @classmethod
+ def poll(cls, context):
+ editmesh = context.mode == 'EDIT_CURVE'
+ return (editmesh)
+
+ def draw(self, context):
+ layout = self.layout
+
+ curve = context.active_object.data
+
+ col = layout.column()
+ col.label(text="Overlays:")
+ col.prop(curve, "show_handles", text="Handles")
+ col.prop(curve, "show_normal_face", text="Normals")
+ col.prop(context.scene.tool_settings, "normal_size", text="Normal Size")
+
+
+class VIEW3D_PT_background_image(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Background Images"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ # bg = context.space_data.background_image
+ return (view)
+
+ def draw_header(self, context):
+ layout = self.layout
+ view = context.space_data
+
+ layout.prop(view, "show_background_images", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+
+ col = layout.column()
+ col.operator("view3d.background_image_add", text="Add Image")
+
+ for i, bg in enumerate(view.background_images):
+ layout.active = view.show_background_images
+ box = layout.box()
+ row = box.row(align=True)
+ row.prop(bg, "show_expanded", text="", emboss=False)
+ if bg.image:
+ row.prop(bg.image, "name", text="", emboss=False)
+ else:
+ row.label(text="Not Set")
+ row.operator("view3d.background_image_remove", text="", emboss=False, icon='X').index = i
+
+ box.prop(bg, "view_axis", text="Axis")
+
+ if bg.show_expanded:
+ row = box.row()
+ row.template_ID(bg, "image", open="image.open")
+ if (bg.image):
+ box.template_image(bg, "image", bg.image_user, compact=True)
+
+ box.prop(bg, "opacity", slider=True)
+ if bg.view_axis != 'CAMERA':
+ box.prop(bg, "size")
+ row = box.row(align=True)
+ row.prop(bg, "offset_x", text="X")
+ row.prop(bg, "offset_y", text="Y")
+
+
+class VIEW3D_PT_transform_orientations(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Transform Orientations"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ view = context.space_data
+ return (view)
+
+ def draw(self, context):
+ layout = self.layout
+
+ view = context.space_data
+
+ col = layout.column()
+
+ col.prop(view, "transform_orientation")
+ col.operator("transform.create_orientation", text="Create")
+
+ orientation = view.current_orientation
+
+ if orientation:
+ col.prop(orientation, "name")
+ col.operator("transform.delete_orientation", text="Delete")
+
+
+class VIEW3D_PT_etch_a_ton(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Skeleton Sketching"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ scene = context.space_data
+ ob = context.active_object
+ return scene and ob and ob.type == 'ARMATURE' and ob.mode == 'EDIT'
+
+ def draw_header(self, context):
+ layout = self.layout
+ toolsettings = context.scene.tool_settings
+
+ layout.prop(toolsettings, "use_bone_sketching", text="")
+
+ def draw(self, context):
+ layout = self.layout
+ toolsettings = context.scene.tool_settings
+
+ col = layout.column()
+
+ col.prop(toolsettings, "use_etch_quick")
+ col.prop(toolsettings, "use_etch_overdraw")
+
+ col.prop(toolsettings, "etch_convert_mode")
+
+ if toolsettings.etch_convert_mode == 'LENGTH':
+ col.prop(toolsettings, "etch_length_limit")
+ elif toolsettings.etch_convert_mode == 'ADAPTIVE':
+ col.prop(toolsettings, "etch_adaptive_limit")
+ elif toolsettings.etch_convert_mode == 'FIXED':
+ col.prop(toolsettings, "etch_subdivision_number")
+ elif toolsettings.etch_convert_mode == 'RETARGET':
+ col.prop(toolsettings, "etch_template")
+ col.prop(toolsettings, "etch_roll_mode")
+ col.prop(toolsettings, "use_etch_autoname")
+ col.prop(toolsettings, "etch_number")
+ col.prop(toolsettings, "etch_side")
+ col.operator("sketch.convert", text="Convert")
+
+
+class VIEW3D_PT_context_properties(bpy.types.Panel):
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'UI'
+ bl_label = "Properties"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def _active_context_member(context):
+ obj = context.object
+ if obj:
+ mode = obj.mode
+ if mode == 'POSE':
+ return "active_pose_bone"
+ elif mode == 'EDIT' and obj.type == 'ARMATURE':
+ return "active_bone"
+ else:
+ return "object"
+
+ return ""
+
+ @classmethod
+ def poll(cls, context):
+ member = cls._active_context_member(context)
+ if member:
+ context_member = getattr(context, member)
+ return context_member and context_member.keys()
+
+ return False
+
+ def draw(self, context):
+ import rna_prop_ui
+ member = __class__._active_context_member(context)
+
+ if member:
+ # Draw with no edit button
+ rna_prop_ui.draw(self.layout, context, member, object, False)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
new file mode 100644
index 00000000000..795e73675eb
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -0,0 +1,1312 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+import bpy
+
+
+class View3DPanel():
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'TOOLS'
+
+
+# **************** standard tool clusters ******************
+
+# History/Repeat tools
+def draw_repeat_tools(context, layout):
+ col = layout.column(align=True)
+ col.label(text="Repeat:")
+ col.operator("screen.repeat_last")
+ col.operator("screen.repeat_history", text="History...")
+
+
+# Keyframing tools
+def draw_keyframing_tools(context, layout):
+ col = layout.column(align=True)
+ col.label(text="Keyframes:")
+ row = col.row()
+ row.operator("anim.keyframe_insert_menu", text="Insert")
+ row.operator("anim.keyframe_delete_v3d", text="Remove")
+
+
+# Grease Pencil tools
+def draw_gpencil_tools(context, layout):
+ col = layout.column(align=True)
+
+ col.label(text="Grease Pencil:")
+
+ row = col.row()
+ row.operator("gpencil.draw", text="Draw").mode = 'DRAW'
+ row.operator("gpencil.draw", text="Line").mode = 'DRAW_STRAIGHT'
+ row.operator("gpencil.draw", text="Erase").mode = 'ERASER'
+
+ row = col.row()
+ row.prop(context.tool_settings, "use_grease_pencil_sessions")
+
+# ********** default tools for objectmode ****************
+
+
+class VIEW3D_PT_tools_objectmode(View3DPanel, bpy.types.Panel):
+ bl_context = "objectmode"
+ bl_label = "Object Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.operator("object.origin_set", text="Origin")
+
+ col = layout.column(align=True)
+ col.label(text="Object:")
+ col.operator("object.duplicate_move")
+ col.operator("object.delete")
+ col.operator("object.join")
+
+ active_object = context.active_object
+ if active_object and active_object.type == 'MESH':
+
+ col = layout.column(align=True)
+ col.label(text="Shading:")
+ col.operator("object.shade_smooth", text="Smooth")
+ col.operator("object.shade_flat", text="Flat")
+
+ draw_keyframing_tools(context, layout)
+
+ col = layout.column(align=True)
+ col.label(text="Motion Paths:")
+ col.operator("object.paths_calculate", text="Calculate Paths")
+ col.operator("object.paths_clear", text="Clear Paths")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+# ********** default tools for editmode_mesh ****************
+
+
+class VIEW3D_PT_tools_meshedit(View3DPanel, bpy.types.Panel):
+ bl_context = "mesh_edit"
+ bl_label = "Mesh Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+ col.operator("transform.shrink_fatten", text="Along Normal")
+
+ col = layout.column(align=True)
+ col.label(text="Deform:")
+ col.operator("transform.edge_slide")
+ col.operator("mesh.rip_move")
+ col.operator("mesh.noise")
+ col.operator("mesh.vertices_smooth")
+
+ col = layout.column(align=True)
+ col.label(text="Add:")
+ col.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Region")
+ col.operator("view3d.edit_mesh_extrude_individual_move", text="Extrude Individual")
+ col.operator("mesh.subdivide")
+ col.operator("mesh.loopcut_slide")
+ col.operator("mesh.duplicate_move", text="Duplicate")
+ col.operator("mesh.spin")
+ col.operator("mesh.screw")
+
+ col = layout.column(align=True)
+ col.label(text="Remove:")
+ col.operator("mesh.delete")
+ col.operator("mesh.merge")
+ col.operator("mesh.remove_doubles")
+
+ col = layout.column(align=True)
+ col.label(text="Normals:")
+ col.operator("mesh.normals_make_consistent", text="Recalculate")
+ col.operator("mesh.flip_normals", text="Flip Direction")
+
+ col = layout.column(align=True)
+ col.label(text="UV Mapping:")
+ col.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
+ col.operator("mesh.mark_seam")
+ col.operator("mesh.mark_seam", text="Clear Seam").clear = True
+
+ col = layout.column(align=True)
+ col.label(text="Shading:")
+ col.operator("mesh.faces_shade_smooth", text="Smooth")
+ col.operator("mesh.faces_shade_flat", text="Flat")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+
+class VIEW3D_PT_tools_meshedit_options(View3DPanel, bpy.types.Panel):
+ bl_context = "mesh_edit"
+ bl_label = "Mesh Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.active_object
+
+ if ob:
+ mesh = context.active_object.data
+ col = layout.column(align=True)
+ col.prop(mesh, "use_mirror_x")
+ sub = col.column()
+ sub.active = ob.data.use_mirror_x
+ sub.prop(mesh, "use_mirror_topology")
+
+ ts = context.tool_settings
+
+ col.label("Edge Select Mode")
+ col.prop(ts, "edge_path_mode", text="")
+ col.prop(context.tool_settings, "edge_path_live_unwrap")
+
+# ********** default tools for editmode_curve ****************
+
+
+class VIEW3D_PT_tools_curveedit(View3DPanel, bpy.types.Panel):
+ bl_context = "curve_edit"
+ bl_label = "Curve Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.operator("transform.transform", text="Tilt").mode = 'TILT'
+ col.operator("transform.transform", text="Shrink/Fatten").mode = 'CURVE_SHRINKFATTEN'
+
+ col = layout.column(align=True)
+ col.label(text="Curve:")
+ col.operator("curve.duplicate")
+ col.operator("curve.delete")
+ col.operator("curve.cyclic_toggle")
+ col.operator("curve.switch_direction")
+ col.operator("curve.spline_type_set")
+
+ col = layout.column(align=True)
+ col.label(text="Handles:")
+ row = col.row()
+ row.operator("curve.handle_type_set", text="Auto").type = 'AUTOMATIC'
+ row.operator("curve.handle_type_set", text="Vector").type = 'VECTOR'
+ row = col.row()
+ row.operator("curve.handle_type_set", text="Align").type = 'ALIGNED'
+ row.operator("curve.handle_type_set", text="Free").type = 'FREE_ALIGN'
+
+ col = layout.column(align=True)
+ col.label(text="Modeling:")
+ col.operator("curve.extrude")
+ col.operator("curve.subdivide")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+# ********** default tools for editmode_surface ****************
+
+
+class VIEW3D_PT_tools_surfaceedit(View3DPanel, bpy.types.Panel):
+ bl_context = "surface_edit"
+ bl_label = "Surface Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.label(text="Curve:")
+ col.operator("curve.duplicate")
+ col.operator("curve.delete")
+ col.operator("curve.cyclic_toggle")
+ col.operator("curve.switch_direction")
+
+ col = layout.column(align=True)
+ col.label(text="Modeling:")
+ col.operator("curve.extrude")
+ col.operator("curve.subdivide")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+# ********** default tools for editmode_text ****************
+
+
+class VIEW3D_PT_tools_textedit(View3DPanel, bpy.types.Panel):
+ bl_context = "text_edit"
+ bl_label = "Text Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Text Edit:")
+ col.operator("font.text_copy", text="Copy")
+ col.operator("font.text_cut", text="Cut")
+ col.operator("font.text_paste", text="Paste")
+
+ col = layout.column(align=True)
+ col.label(text="Set Case:")
+ col.operator("font.case_set", text="To Upper").case = 'UPPER'
+ col.operator("font.case_set", text="To Lower").case = 'LOWER'
+
+ col = layout.column(align=True)
+ col.label(text="Style:")
+ col.operator("font.style_toggle", text="Bold").style = 'BOLD'
+ col.operator("font.style_toggle", text="Italic").style = 'ITALIC'
+ col.operator("font.style_toggle", text="Underline").style = 'UNDERLINE'
+
+ draw_repeat_tools(context, layout)
+
+
+# ********** default tools for editmode_armature ****************
+
+
+class VIEW3D_PT_tools_armatureedit(View3DPanel, bpy.types.Panel):
+ bl_context = "armature_edit"
+ bl_label = "Armature Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.label(text="Bones:")
+ col.operator("armature.bone_primitive_add", text="Add")
+ col.operator("armature.duplicate_move", text="Duplicate")
+ col.operator("armature.delete", text="Delete")
+
+ col = layout.column(align=True)
+ col.label(text="Modeling:")
+ col.operator("armature.extrude_move")
+ col.operator("armature.subdivide", text="Subdivide")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+
+class VIEW3D_PT_tools_armatureedit_options(View3DPanel, bpy.types.Panel):
+ bl_context = "armature_edit"
+ bl_label = "Armature Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ arm = context.active_object.data
+
+ col = layout.column(align=True)
+ col.prop(arm, "use_mirror_x")
+
+# ********** default tools for editmode_mball ****************
+
+
+class VIEW3D_PT_tools_mballedit(View3DPanel, bpy.types.Panel):
+ bl_context = "mball_edit"
+ bl_label = "Meta Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+# ********** default tools for editmode_lattice ****************
+
+
+class VIEW3D_PT_tools_latticeedit(View3DPanel, bpy.types.Panel):
+ bl_context = "lattice_edit"
+ bl_label = "Lattice Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.operator("lattice.make_regular")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+
+# ********** default tools for posemode ****************
+
+
+class VIEW3D_PT_tools_posemode(View3DPanel, bpy.types.Panel):
+ bl_context = "posemode"
+ bl_label = "Pose Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.label(text="Transform:")
+ col.operator("transform.translate")
+ col.operator("transform.rotate")
+ col.operator("transform.resize", text="Scale")
+
+ col = layout.column(align=True)
+ col.label(text="In-Between:")
+ row = col.row()
+ row.operator("pose.push", text="Push")
+ row.operator("pose.relax", text="Relax")
+ col.operator("pose.breakdown", text="Breakdowner")
+
+ col = layout.column(align=True)
+ col.label(text="Pose:")
+ row = col.row()
+ row.operator("pose.copy", text="Copy")
+ row.operator("pose.paste", text="Paste")
+
+ col = layout.column(align=True)
+ col.operator("poselib.pose_add", text="Add To Library")
+
+ draw_keyframing_tools(context, layout)
+
+ col = layout.column(align=True)
+ col.label(text="Motion Paths:")
+ col.operator("pose.paths_calculate", text="Calculate Paths")
+ col.operator("pose.paths_clear", text="Clear Paths")
+
+ draw_repeat_tools(context, layout)
+
+ draw_gpencil_tools(context, layout)
+
+
+class VIEW3D_PT_tools_posemode_options(View3DPanel, bpy.types.Panel):
+ bl_context = "posemode"
+ bl_label = "Pose Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ arm = context.active_object.data
+
+ col = layout.column(align=True)
+ col.prop(arm, "use_auto_ik")
+
+# ********** default tools for paint modes ****************
+
+
+class PaintPanel():
+ bl_space_type = 'VIEW_3D'
+ bl_region_type = 'TOOLS'
+
+ @staticmethod
+ def paint_settings(context):
+ ts = context.tool_settings
+
+ if context.sculpt_object:
+ return ts.sculpt
+ elif context.vertex_paint_object:
+ return ts.vertex_paint
+ elif context.weight_paint_object:
+ return ts.weight_paint
+ elif context.texture_paint_object:
+ return ts.image_paint
+ elif context.particle_edit_object:
+ return ts.particle_edit
+
+ return None
+
+
+class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
+ bl_label = "Brush"
+
+ @classmethod
+ def poll(cls, context):
+ return cls.paint_settings(context)
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = __class__.paint_settings(context)
+ brush = settings.brush
+
+ if not context.particle_edit_object:
+ col = layout.split().column()
+ col.template_ID_preview(settings, "brush", new="brush.add", rows=3, cols=8)
+
+ # Particle Mode #
+
+ # XXX This needs a check if psys is editable.
+ if context.particle_edit_object:
+ # XXX Select Particle System
+ layout.column().prop(settings, "tool", expand=True)
+
+ if settings.tool != 'NONE':
+ col = layout.column()
+ col.prop(brush, "size", slider=True)
+ if settings.tool != 'ADD':
+ col.prop(brush, "strength", slider=True)
+
+ if settings.tool == 'ADD':
+ col.prop(brush, "count")
+ col = layout.column()
+ col.prop(settings, "use_default_interpolate")
+ sub = col.column(align=True)
+ sub.active = settings.use_default_interpolate
+ sub.prop(brush, "steps", slider=True)
+ sub.prop(settings, "default_key_count", slider=True)
+ elif settings.tool == 'LENGTH':
+ layout.prop(brush, "length_mode", expand=True)
+ elif settings.tool == 'PUFF':
+ layout.prop(brush, "puff_mode", expand=True)
+ layout.prop(brush, "use_puff_volume")
+
+ # Sculpt Mode #
+
+ elif context.sculpt_object and brush:
+
+ col = layout.column()
+
+ col.separator()
+
+ row = col.row(align=True)
+
+ if brush.use_locked_size:
+ row.prop(brush, "use_locked_size", toggle=True, text="", icon='LOCKED')
+ row.prop(brush, "unprojected_radius", text="Radius", slider=True)
+ else:
+ row.prop(brush, "use_locked_size", toggle=True, text="", icon='UNLOCKED')
+ row.prop(brush, "size", text="Radius", slider=True)
+
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
+
+ if brush.sculpt_tool not in {'SNAKE_HOOK', 'GRAB', 'ROTATE'}:
+ col.separator()
+
+ row = col.row(align=True)
+
+ if brush.use_space and brush.sculpt_tool not in {'SMOOTH'}:
+ if brush.use_space_atten:
+ row.prop(brush, "use_space_atten", toggle=True, text="", icon='LOCKED')
+ else:
+ row.prop(brush, "use_space_atten", toggle=True, text="", icon='UNLOCKED')
+
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", text="")
+
+ if brush.sculpt_tool not in {'SMOOTH'}:
+ col.separator()
+
+ row = col.row(align=True)
+ row.prop(brush, "auto_smooth_factor", slider=True)
+ row.prop(brush, "use_inverse_smooth_pressure", toggle=True, text="")
+
+ if brush.sculpt_tool in {'GRAB', 'SNAKE_HOOK'}:
+ col.separator()
+
+ row = col.row(align=True)
+ row.prop(brush, "normal_weight", slider=True)
+
+ if brush.sculpt_tool in {'CREASE', 'BLOB'}:
+ col.separator()
+
+ row = col.row(align=True)
+ row.prop(brush, "crease_pinch_factor", slider=True, text="Pinch")
+
+ if brush.sculpt_tool not in {'PINCH', 'INFLATE', 'SMOOTH'}:
+ row = col.row(align=True)
+
+ col.separator()
+
+ if brush.use_original_normal:
+ row.prop(brush, "use_original_normal", toggle=True, text="", icon='LOCKED')
+ else:
+ row.prop(brush, "use_original_normal", toggle=True, text="", icon='UNLOCKED')
+
+ row.prop(brush, "sculpt_plane", text="")
+
+ #if brush.sculpt_tool in {'CLAY', 'CLAY_TUBES', 'FLATTEN', 'FILL', 'SCRAPE'}:
+ if brush.sculpt_tool in {'CLAY', 'FLATTEN', 'FILL', 'SCRAPE'}:
+ row = col.row(align=True)
+ row.prop(brush, "plane_offset", slider=True)
+ row.prop(brush, "use_offset_pressure", text="")
+
+ col.separator()
+
+ row = col.row()
+ row.prop(brush, "use_plane_trim", text="Trim")
+ row = col.row()
+ row.active = brush.use_plane_trim
+ row.prop(brush, "plane_trim", slider=True, text="Distance")
+
+ if brush.sculpt_tool == 'LAYER':
+ row = col.row()
+ row.prop(brush, "height", slider=True, text="Height")
+
+ col.separator()
+
+ row = col.row()
+ row.prop(brush, "use_frontface", text="Front Faces Only")
+
+ col.separator()
+ col.row().prop(brush, "direction", expand=True)
+
+ if brush.sculpt_tool in {'DRAW', 'CREASE', 'BLOB', 'INFLATE', 'LAYER', 'CLAY'}:
+ col.separator()
+
+ col.prop(brush, "use_accumulate")
+
+ if brush.sculpt_tool == 'LAYER':
+ col.separator()
+
+ ob = context.sculpt_object
+ do_persistent = True
+
+ # not supported yet for this case
+ for md in ob.modifiers:
+ if md.type == 'MULTIRES':
+ do_persistent = False
+
+ if do_persistent:
+ col.prop(brush, "use_persistent")
+ col.operator("sculpt.set_persistent_base")
+
+ # Texture Paint Mode #
+
+ elif context.texture_paint_object and brush:
+ col = layout.column()
+ col.template_color_wheel(brush, "color", value_slider=True)
+ col.prop(brush, "color", text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "jitter", slider=True)
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
+
+ col.prop(brush, "blend", text="Blend")
+
+ col = layout.column()
+ col.active = (brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'})
+ col.prop(brush, "use_alpha")
+
+ # Weight Paint Mode #
+ elif context.weight_paint_object and brush:
+ layout.prop(context.tool_settings, "vertex_group_weight", text="Weight", slider=True)
+ layout.prop(context.tool_settings, "use_auto_normalize", text="Auto Normalize")
+
+ col = layout.column()
+
+ row = col.row(align=True)
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "jitter", slider=True)
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
+
+ # Vertex Paint Mode #
+ elif context.vertex_paint_object and brush:
+ col = layout.column()
+ col.template_color_wheel(brush, "color", value_slider=True)
+ col.prop(brush, "color", text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "size", text="Radius", slider=True)
+ row.prop(brush, "use_pressure_size", toggle=True, text="")
+
+ row = col.row(align=True)
+ row.prop(brush, "strength", text="Strength", slider=True)
+ row.prop(brush, "use_pressure_strength", toggle=True, text="")
+
+ # XXX - TODO
+ #row = col.row(align=True)
+ #row.prop(brush, "jitter", slider=True)
+ #row.prop(brush, "use_pressure_jitter", toggle=True, text="")
+
+
+class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
+ bl_label = "Texture"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
+ return (settings and settings.brush and (context.sculpt_object or
+ context.texture_paint_object))
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = __class__.paint_settings(context)
+ brush = settings.brush
+ tex_slot = brush.texture_slot
+
+ col = layout.column()
+
+ col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+ if brush.use_paint_texture:
+ col.prop(brush, "use_fixed_texture")
+
+ if context.sculpt_object:
+ #XXX duplicated from properties_texture.py
+
+ col.separator()
+
+ col.label(text="Brush Mapping:")
+ row = col.row(align=True)
+ row.prop(tex_slot, "map_mode", expand=True)
+
+ col.separator()
+
+ col = layout.column()
+ col.active = tex_slot.map_mode in {'FIXED'}
+ col.label(text="Angle:")
+
+ col = layout.column()
+ if not brush.use_anchor and brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'} and tex_slot.map_mode in {'FIXED'}:
+ col.prop(brush, "texture_angle_source_random", text="")
+ else:
+ col.prop(brush, "texture_angle_source_no_random", text="")
+
+ #row = col.row(align=True)
+ #row.label(text="Angle:")
+ #row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
+
+ #row = col.row(align=True)
+
+ #col = row.column()
+ #col.active = tex_slot.map_mode in {'FIXED'}
+ #col.prop(brush, "use_rake", toggle=True, icon='PARTICLEMODE', text="")
+
+ col = layout.column()
+ col.prop(tex_slot, "angle", text="")
+ col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
+
+ #col = layout.column()
+ #col.prop(brush, "use_random_rotation")
+ #col.active = (not brush.use_rake) and (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'SNAKE_HOOK', 'THUMB', 'ROTATE'}) and tex_slot.map_mode in {'FIXED'}
+
+ split = layout.split()
+
+ col = split.column()
+ col.prop(tex_slot, "offset")
+
+ col = split.column()
+
+ col.prop(tex_slot, "scale")
+
+ col = layout.column()
+
+ row = col.row(align=True)
+ row.label(text="Sample Bias:")
+ row = col.row(align=True)
+ row.prop(brush, "texture_sample_bias", slider=True, text="")
+
+ row = col.row(align=True)
+ row.label(text="Overlay:")
+ row.active = tex_slot.map_mode in {'FIXED', 'TILED'}
+
+ row = col.row(align=True)
+
+ col = row.column()
+
+ if brush.use_texture_overlay:
+ col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_OFF')
+ else:
+ col.prop(brush, "use_texture_overlay", toggle=True, text="", icon='MUTE_IPO_ON')
+
+ col.active = tex_slot.map_mode in {'FIXED', 'TILED'}
+
+ col = row.column()
+ col.prop(brush, "texture_overlay_alpha", text="Alpha")
+ col.active = tex_slot.map_mode in {'FIXED', 'TILED'} and brush.use_texture_overlay
+
+
+class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
+ bl_label = "Tool"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
+ return (settings and settings.brush and
+ (context.sculpt_object or context.texture_paint_object or
+ context.vertex_paint_object or context.weight_paint_object))
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = __class__.paint_settings(context)
+ brush = settings.brush
+ ## Unused
+ # texture_paint = context.texture_paint_object
+ # sculpt = context.sculpt_object
+
+ col = layout.column(align=True)
+
+ if context.sculpt_object:
+ col.prop(brush, "sculpt_tool", expand=False, text="")
+ col.operator("brush.reset")
+ elif context.texture_paint_object:
+ col.prop(brush, "imagepaint_tool", expand=False, text="")
+ elif context.vertex_paint_object or context.weight_paint_object:
+ col.prop(brush, "vertexpaint_tool", expand=False, text="")
+
+ row = layout.row(align=True)
+ row.prop(brush, "use_paint_sculpt", text="", icon='SCULPTMODE_HLT')
+ row.prop(brush, "use_paint_vertex", text="", icon='VPAINT_HLT')
+ row.prop(brush, "use_paint_weight", text="", icon='WPAINT_HLT')
+ row.prop(brush, "use_paint_texture", text="", icon='TPAINT_HLT')
+
+
+class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
+ bl_label = "Stroke"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
+ return (settings and settings.brush and (context.sculpt_object or
+ context.vertex_paint_object or
+ context.weight_paint_object or
+ context.texture_paint_object))
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = __class__.paint_settings(context)
+ brush = settings.brush
+ texture_paint = context.texture_paint_object
+
+ col = layout.column()
+
+ if context.sculpt_object:
+ col.label(text="Stroke Method:")
+ col.prop(brush, "stroke_method", text="")
+
+ if brush.use_anchor:
+ col.separator()
+ row = col.row()
+ row.prop(brush, "use_edge_to_edge", "Edge To Edge")
+
+ if brush.use_airbrush:
+ col.separator()
+ row = col.row()
+ row.prop(brush, "rate", text="Rate", slider=True)
+
+ if brush.use_space:
+ col.separator()
+ row = col.row()
+ row.active = brush.use_space
+ row.prop(brush, "spacing", text="Spacing")
+
+ if (brush.sculpt_tool not in {'GRAB', 'THUMB', 'SNAKE_HOOK', 'ROTATE'}) and (not brush.use_anchor) and (not brush.use_restore_mesh):
+ col = layout.column()
+ col.separator()
+
+ col.prop(brush, "use_smooth_stroke")
+
+ sub = col.column()
+ sub.active = brush.use_smooth_stroke
+ sub.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+ sub.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+
+ col.separator()
+
+ row = col.row(align=True)
+ row.prop(brush, "jitter", slider=True)
+ row.prop(brush, "use_pressure_jitter", toggle=True, text="")
+
+ else:
+ row = col.row()
+ row.prop(brush, "use_airbrush")
+
+ row = col.row()
+ row.active = brush.use_airbrush and (not brush.use_space) and (not brush.use_anchor)
+ row.prop(brush, "rate", slider=True)
+
+ col.separator()
+
+ if not texture_paint:
+ row = col.row()
+ row.prop(brush, "use_smooth_stroke")
+
+ col = layout.column()
+ col.active = brush.use_smooth_stroke
+ col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+ col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+
+ col.separator()
+
+ col = layout.column()
+ col.active = (not brush.use_anchor) and (brush.sculpt_tool not in {'GRAB', 'THUMB', 'ROTATE', 'SNAKE_HOOK'})
+
+ row = col.row()
+ row.prop(brush, "use_space")
+
+ row = col.row()
+ row.active = brush.use_space
+ row.prop(brush, "spacing", text="Spacing")
+
+ #col.prop(brush, "use_space_atten", text="Adaptive Strength")
+ #col.prop(brush, "use_adaptive_space", text="Adaptive Spacing")
+
+ #col.separator()
+
+ #if texture_paint:
+ # row.prop(brush, "use_pressure_spacing", toggle=True, text="")
+
+
+class VIEW3D_PT_tools_brush_curve(PaintPanel, bpy.types.Panel):
+ bl_label = "Curve"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ settings = cls.paint_settings(context)
+ return (settings and settings.brush and settings.brush.curve)
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = self.paint_settings(context)
+
+ brush = settings.brush
+
+ layout.template_curve_mapping(brush, "curve", brush=True)
+
+ row = layout.row(align=True)
+ row.operator("brush.curve_preset", icon="SMOOTHCURVE", text="").shape = 'SMOOTH'
+ row.operator("brush.curve_preset", icon="SPHERECURVE", text="").shape = 'ROUND'
+ row.operator("brush.curve_preset", icon="ROOTCURVE", text="").shape = 'ROOT'
+ row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP'
+ row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE'
+ row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX'
+
+
+class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
+ bl_label = "Options"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.sculpt_object and context.tool_settings.sculpt)
+
+ def draw(self, context):
+ layout = self.layout
+
+ tool_settings = context.tool_settings
+ sculpt = tool_settings.sculpt
+ settings = __class__.paint_settings(context)
+
+ split = layout.split()
+
+ col = split.column()
+
+ col.prop(sculpt, "use_threaded", text="Threaded Sculpt")
+ col.prop(sculpt, "show_low_resolution")
+ col.prop(sculpt, "show_brush")
+
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
+ col = split.column()
+
+ col.label(text="Lock:")
+ row = col.row(align=True)
+ row.prop(sculpt, "lock_x", text="X", toggle=True)
+ row.prop(sculpt, "lock_y", text="Y", toggle=True)
+ row.prop(sculpt, "lock_z", text="Z", toggle=True)
+
+
+class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
+ bl_label = "Symmetry"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.sculpt_object and context.tool_settings.sculpt)
+
+ def draw(self, context):
+
+ layout = self.layout
+
+ sculpt = context.tool_settings.sculpt
+ settings = __class__.paint_settings(context)
+
+ split = layout.split()
+
+ col = split.column()
+
+ col.label(text="Mirror:")
+ col.prop(sculpt, "use_symmetry_x", text="X")
+ col.prop(sculpt, "use_symmetry_y", text="Y")
+ col.prop(sculpt, "use_symmetry_z", text="Z")
+
+ col = split.column()
+
+ col.prop(sculpt, "radial_symmetry", text="Radial")
+
+ col = layout.column()
+
+ col.separator()
+
+ col.prop(sculpt, "use_symmetry_feather", text="Feather")
+
+
+class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
+ bl_label = "Appearance"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.sculpt_object and context.tool_settings.sculpt) or (context.vertex_paint_object and context.tool_settings.vertex_paint) or (context.weight_paint_object and context.tool_settings.weight_paint) or (context.texture_paint_object and context.tool_settings.image_paint)
+
+ def draw(self, context):
+ layout = self.layout
+
+ settings = __class__.paint_settings(context)
+ brush = settings.brush
+
+ col = layout.column()
+
+ if context.sculpt_object and context.tool_settings.sculpt:
+ #if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE', 'CLAY_TUBES'}:
+ if brush.sculpt_tool in {'DRAW', 'INFLATE', 'CLAY', 'PINCH', 'CREASE', 'BLOB', 'FLATTEN', 'FILL', 'SCRAPE'}:
+ col.prop(brush, "cursor_color_add", text="Add Color")
+ col.prop(brush, "cursor_color_subtract", text="Subtract Color")
+ else:
+ col.prop(brush, "cursor_color_add", text="Color")
+ else:
+ col.prop(brush, "cursor_color_add", text="Color")
+
+ col = layout.column()
+ col.label(text="Icon:")
+
+ row = col.row(align=True)
+ row.prop(brush, "use_custom_icon")
+ if brush.use_custom_icon:
+ row = col.row(align=True)
+ row.prop(brush, "icon_filepath", text="")
+
+# ********** default tools for weightpaint ****************
+
+
+class VIEW3D_PT_tools_weightpaint(View3DPanel, bpy.types.Panel):
+ bl_context = "weightpaint"
+ bl_label = "Weight Tools"
+
+ def draw(self, context):
+ layout = self.layout
+
+ ob = context.active_object
+
+ col = layout.column()
+ col.active = ob.vertex_groups.active != None
+ col.operator("object.vertex_group_normalize_all", text="Normalize All")
+ col.operator("object.vertex_group_normalize", text="Normalize")
+ col.operator("object.vertex_group_invert", text="Invert")
+ col.operator("object.vertex_group_clean", text="Clean")
+ col.operator("object.vertex_group_levels", text="Levels")
+
+
+class VIEW3D_PT_tools_weightpaint_options(View3DPanel, bpy.types.Panel):
+ bl_context = "weightpaint"
+ bl_label = "Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ tool_settings = context.tool_settings
+ wpaint = tool_settings.weight_paint
+
+ col = layout.column()
+ col.prop(wpaint, "use_all_faces")
+ col.prop(wpaint, "use_normal")
+ col.prop(wpaint, "use_spray")
+
+ obj = context.weight_paint_object
+ if obj.type == 'MESH':
+ mesh = obj.data
+ col.prop(mesh, "use_mirror_x")
+ col.prop(mesh, "use_mirror_topology")
+
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
+# Commented out because the Apply button isn't an operator yet, making these settings useless
+# col.label(text="Gamma:")
+# col.prop(wpaint, "gamma", text="")
+# col.label(text="Multiply:")
+# col.prop(wpaint, "mul", text="")
+
+# Also missing now:
+# Soft, Vgroup, X-Mirror and "Clear" Operator.
+
+# ********** default tools for vertexpaint ****************
+
+
+class VIEW3D_PT_tools_vertexpaint(View3DPanel, bpy.types.Panel):
+ bl_context = "vertexpaint"
+ bl_label = "Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ tool_settings = context.tool_settings
+ vpaint = tool_settings.vertex_paint
+
+ col = layout.column()
+ #col.prop(vpaint, "mode", text="")
+ col.prop(vpaint, "use_all_faces")
+ col.prop(vpaint, "use_normal")
+ col.prop(vpaint, "use_spray")
+
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
+# Commented out because the Apply button isn't an operator yet, making these settings useless
+# col.label(text="Gamma:")
+# col.prop(vpaint, "gamma", text="")
+# col.label(text="Multiply:")
+# col.prop(vpaint, "mul", text="")
+
+# ********** default tools for texturepaint ****************
+
+
+class VIEW3D_PT_tools_projectpaint(View3DPanel, bpy.types.Panel):
+ bl_context = "texturepaint"
+ bl_label = "Project Paint"
+
+ @classmethod
+ def poll(cls, context):
+ brush = context.tool_settings.image_paint.brush
+ return (brush and brush.imagepaint_tool != 'SOFTEN')
+
+ def draw_header(self, context):
+ ipaint = context.tool_settings.image_paint
+
+ self.layout.prop(ipaint, "use_projection", text="")
+
+ def draw(self, context):
+ layout = self.layout
+
+ ipaint = context.tool_settings.image_paint
+ settings = context.tool_settings.image_paint
+ use_projection = ipaint.use_projection
+
+ col = layout.column()
+ sub = col.column()
+ sub.active = use_projection
+ sub.prop(ipaint, "use_occlude")
+ sub.prop(ipaint, "use_backface_culling")
+
+ split = layout.split()
+
+ col = split.column()
+ col.active = (use_projection)
+ col.prop(ipaint, "use_normal_falloff")
+
+ col = split.column()
+ col.active = (ipaint.use_normal_falloff and use_projection)
+ col.prop(ipaint, "normal_angle", text="")
+
+ col = layout.column(align=False)
+ row = col.row()
+ row.active = (use_projection)
+ row.prop(ipaint, "use_stencil_layer", text="Stencil")
+
+ row2 = row.row(align=False)
+ row2.active = (use_projection and ipaint.use_stencil_layer)
+ row2.menu("VIEW3D_MT_tools_projectpaint_stencil", text=context.active_object.data.uv_texture_stencil.name)
+ row2.prop(ipaint, "invert_stencil", text="", icon='IMAGE_ALPHA')
+
+ col = layout.column()
+ sub = col.column()
+ row = sub.row()
+ row.active = (settings.brush.imagepaint_tool == 'CLONE')
+
+ row.prop(ipaint, "use_clone_layer", text="Layer")
+ row.menu("VIEW3D_MT_tools_projectpaint_clone", text=context.active_object.data.uv_texture_clone.name)
+
+ sub = col.column()
+ sub.prop(ipaint, "seam_bleed")
+
+ col.label(text="External Editing")
+ row = col.split(align=True, percentage=0.55)
+ row.operator("image.project_edit", text="Quick Edit")
+ row.operator("image.project_apply", text="Apply")
+ row = col.row(align=True)
+ row.prop(ipaint, "screen_grab_size", text="")
+
+ sub = col.column()
+ sub.operator("paint.project_image", text="Apply Camera Image")
+
+ sub.operator("image.save_dirty", text="Save All Edited")
+
+
+class VIEW3D_PT_imagepaint_options(PaintPanel):
+ bl_label = "Options"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ @classmethod
+ def poll(cls, context):
+ return (context.texture_paint_object and context.tool_settings.image_paint)
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column()
+
+ tool_settings = context.tool_settings
+ col.label(text="Unified Settings:")
+ col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size")
+ col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength")
+
+
+class VIEW3D_MT_tools_projectpaint_clone(bpy.types.Menu):
+ bl_label = "Clone Layer"
+
+ def draw(self, context):
+ layout = self.layout
+ for i, tex in enumerate(context.active_object.data.uv_textures):
+ prop = layout.operator("wm.context_set_int", text=tex.name)
+ prop.data_path = "active_object.data.uv_texture_clone_index"
+ prop.value = i
+
+
+class VIEW3D_MT_tools_projectpaint_stencil(bpy.types.Menu):
+ bl_label = "Mask Layer"
+
+ def draw(self, context):
+ layout = self.layout
+ for i, tex in enumerate(context.active_object.data.uv_textures):
+ prop = layout.operator("wm.context_set_int", text=tex.name)
+ prop.data_path = "active_object.data.uv_texture_stencil_index"
+ prop.value = i
+
+
+class VIEW3D_PT_tools_particlemode(View3DPanel, bpy.types.Panel):
+ '''default tools for particle mode'''
+ bl_context = "particlemode"
+ bl_label = "Options"
+
+ def draw(self, context):
+ layout = self.layout
+
+ pe = context.tool_settings.particle_edit
+ ob = pe.object
+
+ layout.prop(pe, "type", text="")
+
+ ptcache = None
+
+ if pe.type == 'PARTICLES':
+ if ob.particle_systems:
+ if len(ob.particle_systems) > 1:
+ layout.template_list(ob, "particle_systems", ob.particle_systems, "active_index", type='ICONS')
+
+ ptcache = ob.particle_systems.active.point_cache
+ else:
+ for md in ob.modifiers:
+ if md.type == pe.type:
+ ptcache = md.point_cache
+
+ if ptcache and len(ptcache.point_caches) > 1:
+ layout.template_list(ptcache, "point_caches", ptcache.point_caches, "active_index", type='ICONS')
+
+ if not pe.is_editable:
+ layout.label(text="Point cache must be baked")
+ layout.label(text="in memory to enable editing!")
+
+ col = layout.column(align=True)
+ if pe.is_hair:
+ col.active = pe.is_editable
+ col.prop(pe, "use_emitter_deflect", text="Deflect emitter")
+ sub = col.row()
+ sub.active = pe.use_emitter_deflect
+ sub.prop(pe, "emitter_distance", text="Distance")
+
+ col = layout.column(align=True)
+ col.active = pe.is_editable
+ col.label(text="Keep:")
+ col.prop(pe, "use_preserve_length", text="Lengths")
+ col.prop(pe, "use_preserve_root", text="Root")
+ if not pe.is_hair:
+ col.label(text="Correct:")
+ col.prop(pe, "use_auto_velocity", text="Velocity")
+ col.prop(ob.data, "use_mirror_x")
+
+ col = layout.column(align=True)
+ col.active = pe.is_editable
+ col.label(text="Draw:")
+ col.prop(pe, "draw_step", text="Path Steps")
+ if pe.is_hair:
+ col.prop(pe, "show_particles", text="Children")
+ else:
+ if pe.type == 'PARTICLES':
+ col.prop(pe, "show_particles", text="Particles")
+ col.prop(pe, "use_fade_time")
+ sub = col.row()
+ sub.active = pe.use_fade_time
+ sub.prop(pe, "fade_frames", slider=True)
diff --git a/release/scripts/startup/keyingsets_builtins.py b/release/scripts/startup/keyingsets_builtins.py
new file mode 100644
index 00000000000..6b0b282fd47
--- /dev/null
+++ b/release/scripts/startup/keyingsets_builtins.py
@@ -0,0 +1,365 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+"""
+Built-In Keying Sets
+None of these Keying Sets should be removed, as these
+are needed by various parts of Blender in order for them
+to work correctly.
+"""
+
+import bpy
+import keyingsets_utils
+
+###############################
+# Built-In KeyingSets
+
+
+# Location
+class BUILTIN_KSI_Location(bpy.types.KeyingSetInfo):
+ bl_label = "Location"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for location
+ generate = keyingsets_utils.RKS_GEN_location
+
+
+# Rotation
+class BUILTIN_KSI_Rotation(bpy.types.KeyingSetInfo):
+ bl_label = "Rotation"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for location
+ generate = keyingsets_utils.RKS_GEN_rotation
+
+
+# Scale
+class BUILTIN_KSI_Scaling(bpy.types.KeyingSetInfo):
+ bl_label = "Scaling"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for location
+ generate = keyingsets_utils.RKS_GEN_scaling
+
+# ------------
+
+
+# LocRot
+class BUILTIN_KSI_LocRot(bpy.types.KeyingSetInfo):
+ bl_label = "LocRot"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator
+ def generate(self, context, ks, data):
+ # location
+ keyingsets_utils.RKS_GEN_location(self, context, ks, data)
+ # rotation
+ keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
+
+
+# LocScale
+class BUILTIN_KSI_LocScale(bpy.types.KeyingSetInfo):
+ bl_label = "LocScale"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator
+ def generate(self, context, ks, data):
+ # location
+ keyingsets_utils.RKS_GEN_location(self, context, ks, data)
+ # scale
+ keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
+
+
+# LocRotScale
+class BUILTIN_KSI_LocRotScale(bpy.types.KeyingSetInfo):
+ bl_label = "LocRotScale"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator
+ def generate(self, context, ks, data):
+ # location
+ keyingsets_utils.RKS_GEN_location(self, context, ks, data)
+ # rotation
+ keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
+ # scale
+ keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
+
+
+# RotScale
+class BUILTIN_KSI_RotScale(bpy.types.KeyingSetInfo):
+ bl_label = "RotScale"
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator
+ def generate(self, context, ks, data):
+ # rotation
+ keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
+ # scaling
+ keyingsets_utils.RKS_GEN_scaling(self, context, ks, data)
+
+# ------------
+
+
+# Location
+class BUILTIN_KSI_VisualLoc(bpy.types.KeyingSetInfo):
+ bl_label = "Visual Location"
+
+ bl_options = {'INSERTKEY_VISUAL'}
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for location
+ generate = keyingsets_utils.RKS_GEN_location
+
+
+# Rotation
+class BUILTIN_KSI_VisualRot(bpy.types.KeyingSetInfo):
+ bl_label = "Visual Rotation"
+
+ bl_options = {'INSERTKEY_VISUAL'}
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for rotation
+ generate = keyingsets_utils.RKS_GEN_rotation
+
+
+# VisualLocRot
+class BUILTIN_KSI_VisualLocRot(bpy.types.KeyingSetInfo):
+ bl_label = "Visual LocRot"
+
+ bl_options = {'INSERTKEY_VISUAL'}
+
+ # poll - use predefined callback for selected bones/objects
+ poll = keyingsets_utils.RKS_POLL_selected_items
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator
+ def generate(self, context, ks, data):
+ # location
+ keyingsets_utils.RKS_GEN_location(self, context, ks, data)
+ # rotation
+ keyingsets_utils.RKS_GEN_rotation(self, context, ks, data)
+
+# ------------
+
+
+# Available
+class BUILTIN_KSI_Available(bpy.types.KeyingSetInfo):
+ bl_label = "Available"
+
+ # poll - use predefined callback for selected objects
+ # TODO: this should really check whether the selected object (or datablock)
+ # has any animation data defined yet
+ poll = keyingsets_utils.RKS_POLL_selected_objects
+
+ # iterator - use callback for selected bones/objects
+ iterator = keyingsets_utils.RKS_ITER_selected_item
+
+ # generator - use callback for doing this
+ generate = keyingsets_utils.RKS_GEN_available
+
+###############################
+
+
+# All properties that are likely to get animated in a character rig
+class BUILTIN_KSI_WholeCharacter(bpy.types.KeyingSetInfo):
+ bl_label = "Whole Character"
+
+ # these prefixes should be avoided, as they are not really bones
+ # that animators should be touching (or need to touch)
+ badBonePrefixes = (
+ 'DEF',
+ 'GEO',
+ 'MCH',
+ 'ORG',
+ 'COR',
+ 'VIS',
+ # ... more can be added here as you need in your own rigs ...
+ )
+
+ # poll - pose-mode on active object only
+ def poll(ksi, context):
+ return ((context.active_object) and (context.active_object.pose) and
+ (context.active_object.mode == 'POSE'))
+
+ # iterator - all bones regardless of selection
+ def iterator(ksi, context, ks):
+ for bone in context.active_object.pose.bones:
+ if not bone.name.startswith(BUILTIN_KSI_WholeCharacter.badBonePrefixes):
+ ksi.generate(context, ks, bone)
+
+ # generator - all unlocked bone transforms + custom properties
+ def generate(ksi, context, ks, bone):
+ # loc, rot, scale - only include unlocked ones
+ ksi.doLoc(ks, bone)
+
+ if bone.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
+ ksi.doRot4d(ks, bone)
+ else:
+ ksi.doRot3d(ks, bone)
+ ksi.doScale(ks, bone)
+
+ # custom props?
+ ksi.doCustomProps(ks, bone)
+
+ # ----------------
+
+ # helper to add some bone's property to the Keying Set
+ def addProp(ksi, ks, bone, prop, index=-1, use_groups=True):
+ # add the property name to the base path
+ id_path = bone.path_from_id()
+ id_block = bone.id_data
+
+ if prop.startswith('['):
+ # custom properties
+ path = id_path + prop
+ else:
+ # standard transforms/properties
+ path = keyingsets_utils.path_add_property(id_path, prop)
+
+ # add Keying Set entry for this...
+ if use_groups:
+ ks.paths.add(id_block, path, index, group_method='NAMED', group_name=bone.name)
+ else:
+ ks.paths.add(id_block, path, index)
+
+ # ----------------
+
+ # location properties
+ def doLoc(ksi, ks, bone):
+ if bone.lock_location == (False, False, False):
+ ksi.addProp(ks, bone, "location")
+ else:
+ for i in range(3):
+ if not bone.lock_location[i]:
+ ksi.addProp(ks, bone, "location", i)
+
+ # rotation properties
+ def doRot4d(ksi, ks, bone):
+ # rotation mode affects the property used
+ if bone.rotation_mode == 'QUATERNION':
+ prop = "rotation_quaternion"
+ elif bone.rotation_mode == 'AXIS_ANGLE':
+ prop = "rotation_axis_angle"
+
+ # add rotation properties if they will
+ if bone.lock_rotations_4d:
+ # can check individually
+ if (bone.lock_rotation == (False, False, False)) and (bone.lock_rotation_w == False):
+ ksi.addProp(ks, bone, prop)
+ else:
+ if bone.lock_rotation_w == False:
+ ksi.addProp(ks, bone, prop, 0) # w = 0
+
+ for i in range(3):
+ if not bone.lock_rotation[i]:
+ ksi.addProp(ks, bone, prop, i + 1) # i + 1, since here x,y,z = 1,2,3, and w=0
+ elif True not in bone.lock_rotation:
+ # if axis-angle rotations get locked as eulers, then it's too messy to allow anything
+ # other than all open unless we keyframe the whole lot
+ ksi.addProp(ks, bone, prop)
+
+ def doRot3d(ksi, ks, bone):
+ if bone.lock_rotation == (False, False, False):
+ ksi.addProp(ks, bone, "rotation_euler")
+ else:
+ for i in range(3):
+ if not bone.lock_rotation[i]:
+ ksi.addProp(ks, bone, "rotation_euler", i)
+
+ # scale properties
+ def doScale(ksi, ks, bone):
+ if bone.lock_scale == (0, 0, 0):
+ ksi.addProp(ks, bone, "scale")
+ else:
+ for i in range(3):
+ if not bone.lock_scale[i]:
+ ksi.addProp(ks, bone, "scale", i)
+
+ # ----------------
+
+ # custom properties
+ def doCustomProps(ksi, ks, bone):
+ # go over all custom properties for bone
+ for prop, val in bone.items():
+ # ignore special "_RNA_UI" used for UI editing
+ if prop == "_RNA_UI":
+ continue
+
+ # for now, just add all of 'em
+ ksi.addProp(ks, bone, '["%s"]' % (prop))
+
+
+def register():
+ bpy.utils.register_module(__name__)
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+
+
+if __name__ == "__main__":
+ register()