pep8 corrections.
This commit is contained in:
@@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
# <pep8 compliant>
|
# <pep8 compliant>
|
||||||
|
|
||||||
|
|
||||||
def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None):
|
def image_load(filepath, dirpath, place_holder=False, recursive=False, convert_callback=None):
|
||||||
import bpy
|
import bpy
|
||||||
try:
|
try:
|
||||||
return bpy.data.images.load(filepath)
|
return bpy.data.images.load(filepath)
|
||||||
except SystemError:
|
except SystemError:
|
||||||
return bpy.data.images.new("Untitled", 128, 128)
|
return bpy.data.images.new("Untitled", 128, 128)
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ class AddTorus(bpy.types.Operator):
|
|||||||
location = FloatVectorProperty(name="Location")
|
location = FloatVectorProperty(name="Location")
|
||||||
rotation = FloatVectorProperty(name="Rotation")
|
rotation = FloatVectorProperty(name="Rotation")
|
||||||
|
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
|
||||||
if self.use_abso == True:
|
if self.use_abso == True:
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ def extend(obj, operator, EXTEND_MODE):
|
|||||||
if not me.uv_textures:
|
if not me.uv_textures:
|
||||||
me.uv_textures.new()
|
me.uv_textures.new()
|
||||||
|
|
||||||
|
|
||||||
# Toggle Edit mode
|
# Toggle Edit mode
|
||||||
is_editmode = (obj.mode == 'EDIT')
|
is_editmode = (obj.mode == 'EDIT')
|
||||||
if is_editmode:
|
if is_editmode:
|
||||||
@@ -41,7 +40,7 @@ def extend(obj, operator, EXTEND_MODE):
|
|||||||
edge_average_lengths = {}
|
edge_average_lengths = {}
|
||||||
|
|
||||||
OTHER_INDEX = 2, 3, 0, 1
|
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):
|
def extend_uvs(face_source, face_target, edge_key):
|
||||||
'''
|
'''
|
||||||
@@ -86,30 +85,27 @@ def extend(obj, operator, EXTEND_MODE):
|
|||||||
except:
|
except:
|
||||||
target_matching_edge = edge_idxs_target.index(edge_key_swap)
|
target_matching_edge = edge_idxs_target.index(edge_key_swap)
|
||||||
|
|
||||||
|
|
||||||
edgepair_inner_source = edge_idxs_source[source_matching_edge]
|
edgepair_inner_source = edge_idxs_source[source_matching_edge]
|
||||||
edgepair_inner_target = edge_idxs_target[target_matching_edge]
|
edgepair_inner_target = edge_idxs_target[target_matching_edge]
|
||||||
edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
|
edgepair_outer_source = edge_idxs_source[OTHER_INDEX[source_matching_edge]]
|
||||||
edgepair_outer_target = edge_idxs_target[OTHER_INDEX[target_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]:
|
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
|
iB = 1
|
||||||
else: # The normals of these faces must be different
|
else: # The normals of these faces must be different
|
||||||
iA = 1
|
iA = 1
|
||||||
iB = 0
|
iB = 0
|
||||||
|
|
||||||
|
|
||||||
# Set the target UV's touching source face, no tricky calc needed,
|
# 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[0]][:] = uvs_vhash_source[edgepair_inner_source[iA]]
|
||||||
uvs_vhash_target[edgepair_inner_target[1]][:] = uvs_vhash_source[edgepair_inner_source[iB]]
|
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
|
# 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
|
# for this we need to do basic expaning on the source faces UV's
|
||||||
if EXTEND_MODE == 'LENGTH':
|
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
|
measure the length of each face from the middle of each edge to the opposite
|
||||||
allong the axis we are copying, use this
|
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[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]])
|
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:
|
if not me.uv_textures:
|
||||||
me.uv_textures.new()
|
me.uv_textures.new()
|
||||||
|
|
||||||
@@ -158,15 +153,12 @@ def extend(obj, operator, EXTEND_MODE):
|
|||||||
operator.report({'ERROR'}, "Active face not selected.")
|
operator.report({'ERROR'}, "Active face not selected.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Modes
|
# Modes
|
||||||
# 0 unsearched
|
# 0 unsearched
|
||||||
# 1:mapped, use search from this face. - removed!!
|
# 1:mapped, use search from this face. - removed!!
|
||||||
# 2:all siblings have been searched. dont search again.
|
# 2:all siblings have been searched. dont search again.
|
||||||
face_modes = [0] * len(face_sel)
|
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 connectivty
|
||||||
edge_faces = {}
|
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] += (me_verts[ed[0]].co - me_verts[ed[1]].co).length
|
||||||
looplen[0] = looplen[0] / len(loop)
|
looplen[0] = looplen[0] / len(loop)
|
||||||
|
|
||||||
|
|
||||||
# remove seams, so we dont map accross seams.
|
# remove seams, so we dont map accross seams.
|
||||||
for ed in me.edges:
|
for ed in me.edges:
|
||||||
if ed.use_seam:
|
if ed.use_seam:
|
||||||
@@ -198,31 +189,29 @@ def extend(obj, operator, EXTEND_MODE):
|
|||||||
pass
|
pass
|
||||||
# Done finding seams
|
# Done finding seams
|
||||||
|
|
||||||
|
|
||||||
# face connectivity - faces around each face
|
# face connectivity - faces around each face
|
||||||
# only store a list of indicies for each face.
|
# only store a list of indicies for each face.
|
||||||
face_faces = [[] for i in range(len(face_sel))]
|
face_faces = [[] for i in range(len(face_sel))]
|
||||||
|
|
||||||
for edge_key, faces in edge_faces.items():
|
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[0]].append((faces[1], edge_key))
|
||||||
face_faces[faces[1]].append((faces[0], 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
|
# Now we know what face is connected to what other face, map them by connectivity
|
||||||
ok = True
|
ok = True
|
||||||
while ok:
|
while ok:
|
||||||
ok = False
|
ok = False
|
||||||
for i in range(len(face_sel)):
|
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]:
|
for f_sibling, edge_key in face_faces[i]:
|
||||||
if face_modes[f_sibling] == 0:
|
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)
|
extend_uvs(face_sel[i], face_sel[f_sibling], edge_key)
|
||||||
face_modes[i] = 1 # we can map from this one now.
|
face_modes[i] = 1 # we can map from this one now.
|
||||||
ok = True # keep searching
|
ok = True # keep searching
|
||||||
|
|
||||||
face_modes[i] = 2 # dont search again
|
face_modes[i] = 2 # dont search again
|
||||||
|
|
||||||
if is_editmode:
|
if is_editmode:
|
||||||
bpy.ops.object.mode_set(mode='EDIT')
|
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")
|
layout.prop(mesh, "use_auto_texspace")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
|
class DATA_PT_vertex_groups(MeshButtonsPanel, bpy.types.Panel):
|
||||||
bl_label = "Vertex Groups"
|
bl_label = "Vertex Groups"
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
|
||||||
|
|||||||
@@ -897,9 +897,6 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
if part.physics_type == 'BOIDS':
|
if part.physics_type == 'BOIDS':
|
||||||
col.prop(part, "show_health")
|
col.prop(part, "show_health")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.prop(part, "show_material_color", text="Use material color")
|
col.prop(part, "show_material_color", text="Use material color")
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# DopeSheet Filtering
|
# DopeSheet Filtering
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ def dopesheet_filter(layout, context):
|
|||||||
if dopesheet.show_only_group_objects:
|
if dopesheet.show_only_group_objects:
|
||||||
row.prop(dopesheet, "filter_group", text="")
|
row.prop(dopesheet, "filter_group", text="")
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# DopeSheet Editor - General/Standard UI
|
# DopeSheet Editor - General/Standard UI
|
||||||
|
|
||||||
@@ -187,6 +189,7 @@ class DOPESHEET_MT_select(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("action.select_linked")
|
layout.operator("action.select_linked")
|
||||||
|
|
||||||
|
|
||||||
class DOPESHEET_MT_marker(bpy.types.Menu):
|
class DOPESHEET_MT_marker(bpy.types.Menu):
|
||||||
bl_label = "Marker"
|
bl_label = "Marker"
|
||||||
|
|
||||||
@@ -211,6 +214,7 @@ class DOPESHEET_MT_marker(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.prop(st, "show_pose_markers")
|
layout.prop(st, "show_pose_markers")
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Keyframe Editing
|
# Keyframe Editing
|
||||||
|
|
||||||
@@ -277,6 +281,7 @@ class DOPESHEET_MT_key(bpy.types.Menu):
|
|||||||
layout.operator("action.copy")
|
layout.operator("action.copy")
|
||||||
layout.operator("action.paste")
|
layout.operator("action.paste")
|
||||||
|
|
||||||
|
|
||||||
class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
||||||
bl_label = "Transform"
|
bl_label = "Transform"
|
||||||
|
|
||||||
@@ -289,6 +294,7 @@ class DOPESHEET_MT_key_transform(bpy.types.Menu):
|
|||||||
layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
|
layout.operator("transform.transform", text="Slide").mode = 'TIME_SLIDE'
|
||||||
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
||||||
|
|
||||||
|
|
||||||
#######################################
|
#######################################
|
||||||
# Grease Pencil Editing
|
# Grease Pencil Editing
|
||||||
|
|
||||||
@@ -319,6 +325,7 @@ class DOPESHEET_MT_gpencil_channel(bpy.types.Menu):
|
|||||||
#layout.separator()
|
#layout.separator()
|
||||||
#layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
|
#layout.operator_menu_enum("anim.channels_move", "direction", text="Move...")
|
||||||
|
|
||||||
|
|
||||||
class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
|
class DOPESHEET_MT_gpencil_frame(bpy.types.Menu):
|
||||||
bl_label = "Frame"
|
bl_label = "Frame"
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ class GRAPH_MT_select(bpy.types.Menu):
|
|||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator("graph.select_linked")
|
layout.operator("graph.select_linked")
|
||||||
|
|
||||||
|
|
||||||
class GRAPH_MT_marker(bpy.types.Menu):
|
class GRAPH_MT_marker(bpy.types.Menu):
|
||||||
bl_label = "Marker"
|
bl_label = "Marker"
|
||||||
|
|
||||||
@@ -153,6 +154,7 @@ class GRAPH_MT_marker(bpy.types.Menu):
|
|||||||
|
|
||||||
# TODO: pose markers for action edit mode only?
|
# TODO: pose markers for action edit mode only?
|
||||||
|
|
||||||
|
|
||||||
class GRAPH_MT_channel(bpy.types.Menu):
|
class GRAPH_MT_channel(bpy.types.Menu):
|
||||||
bl_label = "Channel"
|
bl_label = "Channel"
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class NLA_MT_select(bpy.types.Menu):
|
|||||||
layout.operator("nla.select_border")
|
layout.operator("nla.select_border")
|
||||||
layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
|
layout.operator("nla.select_border", text="Border Axis Range").axis_range = True
|
||||||
|
|
||||||
|
|
||||||
class NLA_MT_marker(bpy.types.Menu):
|
class NLA_MT_marker(bpy.types.Menu):
|
||||||
bl_label = "Marker"
|
bl_label = "Marker"
|
||||||
|
|
||||||
@@ -111,6 +112,7 @@ class NLA_MT_marker(bpy.types.Menu):
|
|||||||
layout.operator("marker.rename", text="Rename Marker")
|
layout.operator("marker.rename", text="Rename Marker")
|
||||||
layout.operator("marker.move", text="Grab/Move Marker")
|
layout.operator("marker.move", text="Grab/Move Marker")
|
||||||
|
|
||||||
|
|
||||||
class NLA_MT_edit(bpy.types.Menu):
|
class NLA_MT_edit(bpy.types.Menu):
|
||||||
bl_label = "Edit"
|
bl_label = "Edit"
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ def draw_repeat_tools(context, layout):
|
|||||||
col.operator("screen.repeat_last")
|
col.operator("screen.repeat_last")
|
||||||
col.operator("screen.repeat_history", text="History...")
|
col.operator("screen.repeat_history", text="History...")
|
||||||
|
|
||||||
|
|
||||||
# Grease Pencil tools
|
# Grease Pencil tools
|
||||||
def draw_gpencil_tools(context, layout):
|
def draw_gpencil_tools(context, layout):
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user