diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-21 15:35:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-21 15:35:49 +0300 |
commit | 2e6a02438e997f1024f3ba6c332314f09f01a3b4 (patch) | |
tree | 7b9427c972858a2b0950b0328bb500f11294161b /release/scripts/ui | |
parent | 28d39473fc65543cbf3adc44964d4a9703d3076a (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/ui')
43 files changed, 0 insertions, 20422 deletions
diff --git a/release/scripts/ui/properties_animviz.py b/release/scripts/ui/properties_animviz.py deleted file mode 100644 index 5f5684f5c89..00000000000 --- a/release/scripts/ui/properties_animviz.py +++ /dev/null @@ -1,106 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -# Generic Panels (Independent of DataType) - - -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") - - -# NOTE: -# The specialised panel types are derived in their respective UI modules -# dont register these classes since they are only helpers. -def register(): - pass # bpy.utils.register_module(__name__) - - -def unregister(): - pass # bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py deleted file mode 100644 index 55bc0cdb32f..00000000000 --- a/release/scripts/ui/properties_data_armature.py +++ /dev/null @@ -1,320 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py deleted file mode 100644 index a2c74b31c5e..00000000000 --- a/release/scripts/ui/properties_data_bone.py +++ /dev/null @@ -1,380 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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" - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py deleted file mode 100644 index 5096af42db3..00000000000 --- a/release/scripts/ui/properties_data_camera.py +++ /dev/null @@ -1,147 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py deleted file mode 100644 index 9acd40a3d12..00000000000 --- a/release/scripts/ui/properties_data_curve.py +++ /dev/null @@ -1,403 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_empty.py b/release/scripts/ui/properties_data_empty.py deleted file mode 100644 index 54e00b7099e..00000000000 --- a/release/scripts/ui/properties_data_empty.py +++ /dev/null @@ -1,53 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py deleted file mode 100644 index 52268bfd834..00000000000 --- a/release/scripts/ui/properties_data_lamp.py +++ /dev/null @@ -1,397 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py deleted file mode 100644 index bb22e267b65..00000000000 --- a/release/scripts/ui/properties_data_lattice.py +++ /dev/null @@ -1,93 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py deleted file mode 100644 index fcf03cf0dcc..00000000000 --- a/release/scripts/ui/properties_data_mesh.py +++ /dev/null @@ -1,362 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py deleted file mode 100644 index 961d11d360c..00000000000 --- a/release/scripts/ui/properties_data_metaball.py +++ /dev/null @@ -1,129 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py deleted file mode 100644 index 8d5bc0f3519..00000000000 --- a/release/scripts/ui/properties_data_modifier.py +++ /dev/null @@ -1,712 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_game.py b/release/scripts/ui/properties_game.py deleted file mode 100644 index 4c6bb0e08ec..00000000000 --- a/release/scripts/ui/properties_game.py +++ /dev/null @@ -1,509 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py deleted file mode 100644 index 7fb333c4364..00000000000 --- a/release/scripts/ui/properties_material.py +++ /dev/null @@ -1,980 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py deleted file mode 100644 index 4c1f4d28d5d..00000000000 --- a/release/scripts/ui/properties_object.py +++ /dev/null @@ -1,344 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_object_constraint.py b/release/scripts/ui/properties_object_constraint.py deleted file mode 100644 index b4822b675a9..00000000000 --- a/release/scripts/ui/properties_object_constraint.py +++ /dev/null @@ -1,792 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py deleted file mode 100644 index f67040d6a87..00000000000 --- a/release/scripts/ui/properties_particle.py +++ /dev/null @@ -1,1222 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -from rna_prop_ui import PropertyPanel - -from properties_physics_common import point_cache_ui -from properties_physics_common import effector_weights_ui -from properties_physics_common import basic_force_field_settings_ui -from properties_physics_common import 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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_cloth.py b/release/scripts/ui/properties_physics_cloth.py deleted file mode 100644 index 0ac4429c71a..00000000000 --- a/release/scripts/ui/properties_physics_cloth.py +++ /dev/null @@ -1,227 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -from properties_physics_common import point_cache_ui -from properties_physics_common import 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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_common.py b/release/scripts/ui/properties_physics_common.py deleted file mode 100644 index e03c29cd549..00000000000 --- a/release/scripts/ui/properties_physics_common.py +++ /dev/null @@ -1,293 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_field.py b/release/scripts/ui/properties_physics_field.py deleted file mode 100644 index 7023f0c5058..00000000000 --- a/release/scripts/ui/properties_physics_field.py +++ /dev/null @@ -1,227 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -from properties_physics_common import basic_force_field_settings_ui -from properties_physics_common import 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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_fluid.py b/release/scripts/ui/properties_physics_fluid.py deleted file mode 100644 index 06b614d0b45..00000000000 --- a/release/scripts/ui/properties_physics_fluid.py +++ /dev/null @@ -1,292 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_smoke.py b/release/scripts/ui/properties_physics_smoke.py deleted file mode 100644 index 773382ba3d8..00000000000 --- a/release/scripts/ui/properties_physics_smoke.py +++ /dev/null @@ -1,212 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -from properties_physics_common import point_cache_ui -from properties_physics_common import 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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_physics_softbody.py b/release/scripts/ui/properties_physics_softbody.py deleted file mode 100644 index 7d3fa66ed02..00000000000 --- a/release/scripts/ui/properties_physics_softbody.py +++ /dev/null @@ -1,272 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -from properties_physics_common import point_cache_ui -from properties_physics_common import 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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py deleted file mode 100644 index c5e56a61a8c..00000000000 --- a/release/scripts/ui/properties_render.py +++ /dev/null @@ -1,649 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py deleted file mode 100644 index e28753f2df8..00000000000 --- a/release/scripts/ui/properties_scene.py +++ /dev/null @@ -1,314 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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'} - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py deleted file mode 100644 index a67df41ab8b..00000000000 --- a/release/scripts/ui/properties_texture.py +++ /dev/null @@ -1,1041 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py deleted file mode 100644 index fd11f299f34..00000000000 --- a/release/scripts/ui/properties_world.py +++ /dev/null @@ -1,278 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py deleted file mode 100644 index 7e75c05f603..00000000000 --- a/release/scripts/ui/space_console.py +++ /dev/null @@ -1,171 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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'} - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_dopesheet.py b/release/scripts/ui/space_dopesheet.py deleted file mode 100644 index 57b5a1fb97f..00000000000 --- a/release/scripts/ui/space_dopesheet.py +++ /dev/null @@ -1,373 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -import bpy - - -####################################### -# 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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_filebrowser.py b/release/scripts/ui/space_filebrowser.py deleted file mode 100644 index 0c551433184..00000000000 --- a/release/scripts/ui/space_filebrowser.py +++ /dev/null @@ -1,85 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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="") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_graph.py b/release/scripts/ui/space_graph.py deleted file mode 100644 index f0c987c2b93..00000000000 --- a/release/scripts/ui/space_graph.py +++ /dev/null @@ -1,258 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -import bpy - - -class GRAPH_HT_header(bpy.types.Header): - bl_space_type = 'GRAPH_EDITOR' - - def draw(self, context): - from space_dopesheet import dopesheet_filter - - layout = self.layout - - st = context.space_data - - 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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py deleted file mode 100644 index 46b164c6fdc..00000000000 --- a/release/scripts/ui/space_image.py +++ /dev/null @@ -1,764 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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' - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py deleted file mode 100644 index 2ec099dc051..00000000000 --- a/release/scripts/ui/space_info.py +++ /dev/null @@ -1,411 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -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'} - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py deleted file mode 100644 index 3c55853e2e2..00000000000 --- a/release/scripts/ui/space_logic.py +++ /dev/null @@ -1,98 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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') - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_nla.py b/release/scripts/ui/space_nla.py deleted file mode 100644 index 7388a839d6d..00000000000 --- a/release/scripts/ui/space_nla.py +++ /dev/null @@ -1,202 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> - -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_node.py b/release/scripts/ui/space_node.py deleted file mode 100644 index 1076b13c28e..00000000000 --- a/release/scripts/ui/space_node.py +++ /dev/null @@ -1,204 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_outliner.py b/release/scripts/ui/space_outliner.py deleted file mode 100644 index 4108e7358b4..00000000000 --- a/release/scripts/ui/space_outliner.py +++ /dev/null @@ -1,128 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py deleted file mode 100644 index 872b64e0e6d..00000000000 --- a/release/scripts/ui/space_sequencer.py +++ /dev/null @@ -1,812 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py deleted file mode 100644 index d1ccdf2acbb..00000000000 --- a/release/scripts/ui/space_text.py +++ /dev/null @@ -1,310 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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") - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_time.py b/release/scripts/ui/space_time.py deleted file mode 100644 index ba10c370389..00000000000 --- a/release/scripts/ui/space_time.py +++ /dev/null @@ -1,209 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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') - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py deleted file mode 100644 index 89f703d8981..00000000000 --- a/release/scripts/ui/space_userpref.py +++ /dev/null @@ -1,1214 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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 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'} - - -def register(): - bpy.utils.register_module(__name__) - - 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'}) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py deleted file mode 100644 index 60bd89db60a..00000000000 --- a/release/scripts/ui/space_userpref_keymap.py +++ /dev/null @@ -1,792 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy -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'} - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py deleted file mode 100644 index 751d54dd289..00000000000 --- a/release/scripts/ui/space_view3d.py +++ /dev/null @@ -1,2314 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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' - - -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") - -# ********** 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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py deleted file mode 100644 index 47660810ea9..00000000000 --- a/release/scripts/ui/space_view3d_toolbar.py +++ /dev/null @@ -1,1323 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -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) - - -def register(): - bpy.utils.register_module(__name__) - - -def unregister(): - bpy.utils.unregister_module(__name__) - -if __name__ == "__main__": - register() |