-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpipeUnwrapHelper.py
More file actions
57 lines (46 loc) · 1.34 KB
/
Copy pathpipeUnwrapHelper.py
File metadata and controls
57 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Brute Force Pipe Unwrap
import bpy
print("--<<RUNNING>>--")
def main(context):
print("----main----")
#obj = bpy.context.object
#original_type = bpy.context.area.type
obj = bpy.data.objects['BezierCurve.002']
#bpy.context.area.type = "VIEW_3D"
a = len(obj.data.polygons)
for index in range(a):
obj.data.polygons[index].select=True
obj.data.polygons.active = index
bpy.ops.mesh.select_linked(limit=True)
bpy.ops.uv.follow_active_quads(mode='LENGTH_AVERAGE')
#f.hide=False
#bpy.ops.mesh.reveal()
#bpy.context.area.type = original_type
class ToolsPanel(bpy.types.Panel):
bl_label = "Pipe Unwrap (BRUTE FORCE)"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
layout = self.layout
row=layout.row()
row.operator("object.unwrap_pipes",icon="FORCE_TEXTURE")
class OBJECT_OT_unwrapPipes(bpy.types.Operator):
'''Click on ME'''
bl_idname = "object.unwrap_pipes"
bl_label = "Unwrap Pipes"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
main(context)
return {'FINISHED'}
def invoke(self, context, event):
wm = context.window_manager
return wm.invoke_props_dialog(self)
def register():
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()