pep8 corrections.
This commit is contained in:
parent
6c3d7c7f12
commit
9146ca06dd
@ -18,10 +18,10 @@
|
||||
|
||||
# <pep8 compliant>
|
||||
|
||||
|
||||
def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None):
|
||||
import bpy
|
||||
try:
|
||||
return bpy.data.images.load(filepath)
|
||||
except SystemError:
|
||||
return bpy.data.images.new("Untitled", 128, 128)
|
||||
|
||||
|
@ -108,7 +108,6 @@ class AddTorus(bpy.types.Operator):
|
||||
location = FloatVectorProperty(name="Location")
|
||||
rotation = FloatVectorProperty(name="Rotation")
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
if self.use_abso == True:
|
||||
|
@ -31,7 +31,6 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
|
||||
# Toggle Edit mode
|
||||
is_editmode = (obj.mode == 'EDIT')
|
||||
if is_editmode:
|
||||
@ -41,7 +40,7 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
edge_average_lengths = {}
|
||||
|
||||
OTHER_INDEX = 2, 3, 0, 1
|
||||
FAST_INDICIES = 0, 2, 1, 3 # order is faster
|
||||
FAST_INDICIES = 0, 2, 1, 3 # order is faster
|
||||
|
||||
def extend_uvs(face_source, face_target, edge_key):
|
||||
'''
|
||||
@ -86,30 +85,27 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
except:
|
||||
target_matching_edge = edge_idxs_target.index(edge_key_swap)
|
||||
|
||||
|
||||
edgepair_inner_source = edge_idxs_source[source_matching_edge]
|
||||
edgepair_inner_target = edge_idxs_target[target_matching_edge]
|
||||
edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
|
||||
edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_matching_edge]]
|
||||
|
||||
if edge_idxs_source[source_matching_edge] == edge_idxs_target[target_matching_edge]:
|
||||
iA = 0 # Flipped, most common
|
||||
iA = 0 # Flipped, most common
|
||||
iB = 1
|
||||
else: # The normals of these faces must be different
|
||||
else: # The normals of these faces must be different
|
||||
iA = 1
|
||||
iB = 0
|
||||
|
||||
|
||||
# Set the target UV's touching source face, no tricky calc needed,
|
||||
uvs_vhash_target[edgepair_inner_target[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
|
||||
uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
|
||||
|
||||
|
||||
# Set the 2 UV's on the target face that are not touching
|
||||
# for this we need to do basic expaning on the source faces UV's
|
||||
if EXTEND_MODE == 'LENGTH':
|
||||
|
||||
try: # divide by zero is possible
|
||||
try: # divide by zero is possible
|
||||
'''
|
||||
measure the length of each face from the middle of each edge to the opposite
|
||||
allong the axis we are copying, use this
|
||||
@ -137,7 +133,6 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
uvs_vhash_target[edgepair_outer_target[iB]][:] = uvs_vhash_source[edgepair_inner_source[0]] + (uvs_vhash_source[edgepair_inner_source[0]] - uvs_vhash_source[edgepair_outer_source[1]])
|
||||
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
|
||||
|
||||
|
||||
if not me.uv_textures:
|
||||
me.uv_textures.new()
|
||||
|
||||
@ -158,15 +153,12 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
operator.report({'ERROR'}, "Active face not selected.")
|
||||
return
|
||||
|
||||
|
||||
|
||||
# Modes
|
||||
# 0 unsearched
|
||||
# 1:mapped, use search from this face. - removed!!
|
||||
# 2:all siblings have been searched. dont search again.
|
||||
face_modes = [0] * len(face_sel)
|
||||
face_modes[face_act_local_index] = 1 # extend UV's from this face.
|
||||
|
||||
face_modes[face_act_local_index] = 1 # extend UV's from this face.
|
||||
|
||||
# Edge connectivty
|
||||
edge_faces = {}
|
||||
@ -187,7 +179,6 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
looplen[0] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
|
||||
looplen[0] = looplen[0] / len(loop)
|
||||
|
||||
|
||||
# remove seams, so we dont map accross seams.
|
||||
for ed in me.edges:
|
||||
if ed.use_seam:
|
||||
@ -198,31 +189,29 @@ def extend(obj, operator, EXTEND_MODE):
|
||||
pass
|
||||
# Done finding seams
|
||||
|
||||
|
||||
# face connectivity - faces around each face
|
||||
# only store a list of indicies for each face.
|
||||
face_faces = [[] for i in range(len(face_sel))]
|
||||
|
||||
for edge_key, faces in edge_faces.items():
|
||||
if len(faces) == 2: # Only do edges with 2 face users for now
|
||||
if len(faces) == 2: # Only do edges with 2 face users for now
|
||||
face_faces[faces[0]].append((faces[1], edge_key))
|
||||
face_faces[faces[1]].append((faces[0], edge_key))
|
||||
|
||||
|
||||
# Now we know what face is connected to what other face, map them by connectivity
|
||||
ok = True
|
||||
while ok:
|
||||
ok = False
|
||||
for i in range(len(face_sel)):
|
||||
if face_modes[i] == 1: # searchable
|
||||
if face_modes[i] == 1: # searchable
|
||||
for f_sibling, edge_key in face_faces[i]:
|
||||
if face_modes[f_sibling] == 0:
|
||||
face_modes[f_sibling] = 1 # mapped and search from.
|
||||
face_modes[f_sibling] = 1 # mapped and search from.
|
||||
extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
|
||||
face_modes[i] = 1 # we can map from this one now.
|
||||
ok = True # keep searching
|
||||
face_modes[i] = 1 # we can map from this one now.
|
||||
ok = True # keep searching
|
||||
|
||||
face_modes[i] = 2 # dont search again
|
||||
face_modes[i] = 2 # dont search again
|
||||
|
||||
if is_editmode:
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
@ -111,7 +111,6 @@ class DATA_PT_settings(MeshButtonsPanel, bpy.types.Panel):
|
||||
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'}
|
||||
|
@ -896,9 +896,6 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
|
||||
col.prop(part, "show_number")
|
||||
if part.physics_type == 'BOIDS':
|
||||
col.prop(part, "show_health")
|
||||
|
||||
|
||||
|
||||
|
||||
col = row.column()
|
||||
col.prop(part, "show_material_color", text="Use material color")
|
||||
@ -956,7 +953,7 @@ class PARTICLE_PT_children(ParticleButtonsPanel, bpy.types.Panel):
|
||||
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)
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
#######################################
|
||||
# DopeSheet Filtering
|
||||
|
||||
@ -72,6 +73,7 @@ def dopesheet_filter(layout, context):
|
||||
if dopesheet.show_only_group_objects:
|
||||
row.prop(dopesheet, "filter_group", text="")
|
||||
|
||||
|
||||
#######################################
|
||||
# DopeSheet Editor - General/Standard UI
|
||||
|
||||
@ -111,7 +113,7 @@ class DOPESHEET_HT_header(bpy.types.Header):
|
||||
|
||||
elif 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="")
|
||||
@ -177,7 +179,7 @@ class DOPESHEET_MT_select(bpy.types.Menu):
|
||||
|
||||
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'
|
||||
|
||||
|
||||
# FIXME: grease pencil mode isn't supported for these yet, so skip for that mode only
|
||||
if context.space_data.mode != 'GPENCIL':
|
||||
layout.separator()
|
||||
@ -187,30 +189,32 @@ class DOPESHEET_MT_select(bpy.types.Menu):
|
||||
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")
|
||||
|
||||
|
||||
#######################################
|
||||
# Keyframe Editing
|
||||
|
||||
@ -277,6 +281,7 @@ class DOPESHEET_MT_key(bpy.types.Menu):
|
||||
layout.operator("action.copy")
|
||||
layout.operator("action.paste")
|
||||
|
||||
|
||||
class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
||||
bl_label = "Transform"
|
||||
|
||||
@ -289,12 +294,13 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
||||
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
|
||||
|
||||
@ -310,7 +316,7 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
|
||||
|
||||
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")
|
||||
@ -319,6 +325,7 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
|
||||
#layout.separator()
|
||||
#layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
|
||||
|
||||
|
||||
class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
|
||||
bl_label = "Frame"
|
||||
|
||||
@ -338,7 +345,7 @@ class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
|
||||
#layout.separator()
|
||||
#layout.operator("action.copy")
|
||||
#layout.operator("action.paste")
|
||||
|
||||
|
||||
|
||||
def register():
|
||||
pass
|
||||
|
@ -133,26 +133,28 @@ class GRAPH_MT_select(bpy.types.Menu):
|
||||
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"
|
||||
|
||||
|
@ -93,24 +93,26 @@ class NLA_MT_select(bpy.types.Menu):
|
||||
layout.operator("nla.select_border")
|
||||
layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
@ -183,14 +183,14 @@ class SEQUENCER_MT_marker(bpy.types.Menu):
|
||||
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")
|
||||
|
||||
|
@ -147,7 +147,7 @@ class TIME_MT_frame(bpy.types.Menu):
|
||||
layout.operator("marker.delete", text="Delete Marker")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
||||
layout.operator("marker.rename", text="Rename Marker")
|
||||
layout.operator("marker.move", text="Grab/Move Marker")
|
||||
|
||||
|
@ -34,17 +34,18 @@ def draw_repeat_tools(context, layout):
|
||||
col.operator("screen.repeat_last")
|
||||
col.operator("screen.repeat_history", text="History...")
|
||||
|
||||
|
||||
# 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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user