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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-03-19 04:49:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-03-19 04:49:18 +0300
commit57f376e9465c6b79ebd4409bc30e0b5930dd4140 (patch)
tree8dc6d5940bc8c39d7979d3b35c19d91f4bb83bf0
parent1338695613af08ae912e6507f0fc89d54577e11a (diff)
Cleanup: trailing space
-rw-r--r--add_curve_extra_objects/__init__.py2
-rw-r--r--add_curve_ivygen.py2
-rw-r--r--add_mesh_BoltFactory/Boltfactory.py40
-rw-r--r--add_mesh_BoltFactory/createMesh.py2
-rw-r--r--add_mesh_ant_landscape.py6
-rw-r--r--animation_animall.py158
-rw-r--r--curve_simplify.py2
-rw-r--r--development_api_navigator.py168
-rw-r--r--game_engine_save_as_runtime.py34
-rw-r--r--io_coat3D/coat.py122
-rw-r--r--io_coat3D/tex.py56
-rw-r--r--io_convert_image_to_mesh_img/import_img.py4
-rw-r--r--io_export_dxf/draw_blenders/__init__.py4
-rw-r--r--io_export_dxf/export_dxf.py18
-rw-r--r--io_export_dxf/model/dxfLibrary.py28
-rw-r--r--io_export_dxf/model/migiusModel.py10
-rw-r--r--io_export_dxf/model/model.py4
-rw-r--r--io_export_dxf/operator.py12
-rw-r--r--io_export_dxf/primitive_exporters/__init__.py2
-rw-r--r--io_export_dxf/primitive_exporters/base_exporter.py46
-rw-r--r--io_export_dxf/primitive_exporters/curve_exporter.py22
-rw-r--r--io_export_dxf/primitive_exporters/insert_exporter.py2
-rw-r--r--io_export_dxf/primitive_exporters/mesh_exporter.py20
-rw-r--r--io_export_dxf/primitive_exporters/text_exporter.py2
-rw-r--r--io_import_dxf/dxfgrabber/styles.py2
-rw-r--r--io_import_gimp_image_to_scene.py254
-rw-r--r--io_import_scene_unreal_psa_psk.py66
-rw-r--r--io_mesh_pdb/export_pdb.py12
-rw-r--r--io_mesh_pdb/import_pdb.py342
-rw-r--r--io_mesh_stl/stl_utils.py2
-rw-r--r--io_scene_fbx/export_fbx.py2
-rw-r--r--io_scene_fbx/import_fbx.py2
-rw-r--r--io_scene_obj/export_obj.py2
-rw-r--r--light_field_tools/light_field_tools.py36
-rw-r--r--mesh_f2.py4
-rw-r--r--mesh_looptools.py6
-rw-r--r--netrender/baking.py32
-rw-r--r--netrender/balancing.py4
-rw-r--r--netrender/client.py62
-rw-r--r--netrender/master.py60
-rw-r--r--netrender/master_html.py146
-rw-r--r--netrender/model.py54
-rw-r--r--netrender/operators.py52
-rw-r--r--netrender/repath.py46
-rw-r--r--netrender/slave.py88
-rw-r--r--netrender/thumbnail.py8
-rw-r--r--netrender/ui.py82
-rw-r--r--netrender/utils.py52
-rw-r--r--netrender/versioning.py36
-rw-r--r--node_wrangler.py58
-rw-r--r--object_animrenderbake.py2
-rw-r--r--object_boolean_tools.py6
-rw-r--r--object_cloud_gen.py186
-rw-r--r--object_fracture_cell/__init__.py16
-rw-r--r--oscurart_tools/oscurart_meshes.py8
-rw-r--r--oscurart_tools/oscurart_objects.py4
-rw-r--r--oscurart_tools/oscurart_render.py2
-rw-r--r--pie_menus_official/pie_clip_marker_of.py2
-rw-r--r--render_povray/__init__.py240
-rw-r--r--render_povray/nodes.py39
-rw-r--r--render_povray/primitives.py289
-rw-r--r--render_povray/render.py272
-rw-r--r--render_povray/shading.py268
-rw-r--r--render_povray/ui.py334
-rw-r--r--rigify/rigs/pitchipoy/limbs/arm.py18
-rw-r--r--rigify/rigs/pitchipoy/limbs/leg.py68
-rw-r--r--rigify/rigs/pitchipoy/limbs/limb_utils.py14
-rw-r--r--rigify/rigs/pitchipoy/limbs/paw.py24
-rw-r--r--rigify/rigs/pitchipoy/limbs/super_limb.py138
-rw-r--r--rigify/rigs/pitchipoy/limbs/ui.py10
-rw-r--r--rigify/rigs/pitchipoy/simple_tentacle.py90
-rw-r--r--rigify/rigs/pitchipoy/super_copy.py24
-rwxr-xr-xrigify/rigs/pitchipoy/super_face.py358
-rw-r--r--rigify/rigs/pitchipoy/super_finger.py116
-rw-r--r--rigify/rigs/pitchipoy/super_torso_turbo.py212
-rw-r--r--rigify/rigs/pitchipoy/super_widgets.py14
-rw-r--r--rigify/rigs/pitchipoy/tentacle.py138
-rw-r--r--rigify/ui.py2
-rw-r--r--rigify/utils.py2
-rw-r--r--system_blend_info.py4
-rw-r--r--ui_layer_manager.py4
81 files changed, 2589 insertions, 2591 deletions
diff --git a/add_curve_extra_objects/__init__.py b/add_curve_extra_objects/__init__.py
index ffa04938..05a8e873 100644
--- a/add_curve_extra_objects/__init__.py
+++ b/add_curve_extra_objects/__init__.py
@@ -156,7 +156,7 @@ class INFO_MT_curve_knots_add1(bpy.types.Menu):
text="Celtic Links")
layout.operator("mesh.add_braid",
text="Braid Knot")
-
+
# Define "Extras" menus
diff --git a/add_curve_ivygen.py b/add_curve_ivygen.py
index 66ca8c45..9655a940 100644
--- a/add_curve_ivygen.py
+++ b/add_curve_ivygen.py
@@ -537,7 +537,7 @@ class IvyGen(bpy.types.Operator):
return ((ob is not None) and
(ob.type == 'MESH') and
(context.mode == 'OBJECT'))
-
+
def invoke(self, context, event):
self.updateIvy = True
return self.execute(context)
diff --git a/add_mesh_BoltFactory/Boltfactory.py b/add_mesh_BoltFactory/Boltfactory.py
index aac6d51d..66b0c32f 100644
--- a/add_mesh_BoltFactory/Boltfactory.py
+++ b/add_mesh_BoltFactory/Boltfactory.py
@@ -44,17 +44,17 @@ class add_mesh_bolt(bpy.types.Operator):
bl_label = "Add Bolt"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
bl_description = "adds many types of Bolts"
-
+
align_matrix = mathutils.Matrix()
MAX_INPUT_NUMBER = 50
-
+
# edit - Whether to add or update.
edit = BoolProperty(name="",
description="",
default=False,
options={'HIDDEN'})
-
+
#Model Types
Model_Type_List = [('bf_Model_Bolt','BOLT','Bolt Model'),
('bf_Model_Nut','NUT','Nut Model')]
@@ -63,7 +63,7 @@ class add_mesh_bolt(bpy.types.Operator):
description='Choose the type off model you would like',
items = Model_Type_List, default = 'bf_Model_Bolt')
- #Head Types
+ #Head Types
Model_Type_List = [('bf_Head_Hex','HEX','Hex Head'),
('bf_Head_Cap','CAP','Cap Head'),
('bf_Head_Dome','DOME','Dome Head'),
@@ -73,7 +73,7 @@ class add_mesh_bolt(bpy.types.Operator):
name='Head',
description='Choose the type off Head you would like',
items = Model_Type_List, default = 'bf_Head_Hex')
-
+
#Bit Types
Bit_Type_List = [('bf_Bit_None','NONE','No Bit Type'),
('bf_Bit_Allen','ALLEN','Allen Bit Type'),
@@ -82,7 +82,7 @@ class add_mesh_bolt(bpy.types.Operator):
name='Bit Type',
description='Choose the type of bit to you would like',
items = Bit_Type_List, default = 'bf_Bit_None')
-
+
#Nut Types
Nut_Type_List = [('bf_Nut_Hex','HEX','Hex Nut'),
('bf_Nut_Lock','LOCK','Lock Nut')]
@@ -90,20 +90,20 @@ class add_mesh_bolt(bpy.types.Operator):
name='Nut Type',
description='Choose the type of nut you would like',
items = Nut_Type_List, default = 'bf_Nut_Hex')
-
- #Shank Types
+
+ #Shank Types
bf_Shank_Length = FloatProperty(attr='bf_Shank_Length',
name='Shank Length', default = 0,
- min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
+ min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
description='Length of the unthreaded shank')
-
+
bf_Shank_Dia = FloatProperty(attr='bf_Shank_Dia',
name='Shank Dia', default = 3,
min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
description='Diameter of the shank')
-
+
bf_Phillips_Bit_Depth = FloatProperty(attr='bf_Phillips_Bit_Depth',
- name='Bit Depth', default = 1.1431535482406616,
+ name='Bit Depth', default = 1.1431535482406616,
min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
description='Depth of the Phillips Bit')
@@ -111,12 +111,12 @@ class add_mesh_bolt(bpy.types.Operator):
name='Bit Depth', default = 1.5,
min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
description='Depth of the Allen Bit')
-
+
bf_Allen_Bit_Flat_Distance = FloatProperty( attr='bf_Allen_Bit_Flat_Distance',
name='Flat Dist', default = 2.5,
min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
description='Flat Distance of the Allen Bit')
-
+
bf_Hex_Head_Height = FloatProperty( attr='bf_Hex_Head_Height',
name='Head Height', default = 2,
min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
@@ -156,7 +156,7 @@ class add_mesh_bolt(bpy.types.Operator):
name='Bit Dia', default = 1.8199999332427979,
min = 0, soft_min = 0,max = MAX_INPUT_NUMBER,
description='Diameter of the Philips Bit')
-
+
bf_Thread_Length = FloatProperty( attr='bf_Thread_Length',
name='Thread Length', default = 6,
min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
@@ -176,7 +176,7 @@ class add_mesh_bolt(bpy.types.Operator):
name='Minor Dia', default = 2.6211137771606445,
min = 0, soft_min = 0, max = MAX_INPUT_NUMBER,
description='Inside diameter of the Thread')
-
+
bf_Crest_Percent = IntProperty( attr='bf_Crest_Percent',
name='Crest Percent', default = 10,
min = 1, soft_min = 1, max = 90,
@@ -186,7 +186,7 @@ class add_mesh_bolt(bpy.types.Operator):
name='Root Percent', default = 10,
min = 1, soft_min = 1, max = 90,
description='Percent of the pitch that makes up the Root')
-
+
bf_Div_Count = IntProperty( attr='bf_Div_Count',
name='Div count', default = 36,
min = 4, soft_min = 4, max = 4096,
@@ -205,7 +205,7 @@ class add_mesh_bolt(bpy.types.Operator):
def draw(self, context):
layout = self.layout
col = layout.column()
-
+
#ENUMS
col.prop(self, 'bf_Model_Type')
col.separator()
@@ -270,11 +270,11 @@ class add_mesh_bolt(bpy.types.Operator):
##### EXECUTE #####
def execute(self, context):
-
+
#print('EXECUTING...')
Create_New_Mesh(self, context, self.align_matrix)
return {'FINISHED'}
-
+
##### INVOKE #####
def invoke(self, context, event):
#print('\n___________START_____________')
diff --git a/add_mesh_BoltFactory/createMesh.py b/add_mesh_BoltFactory/createMesh.py
index 80291c81..58470c01 100644
--- a/add_mesh_BoltFactory/createMesh.py
+++ b/add_mesh_BoltFactory/createMesh.py
@@ -1071,7 +1071,7 @@ def Create_Shank_Verts(START_DIA,OUTTER_DIA,LENGTH,Z_LOCATION,DIV_COUNT):
def Create_Thread_Start_Verts(INNER_DIA,OUTTER_DIA,PITCH,CREST_PERCENT,ROOT_PERCENT,Z_LOCATION,DIV_COUNT):
verts = []
-
+
INNER_RADIUS = INNER_DIA/2
OUTTER_RADIUS = OUTTER_DIA/2
diff --git a/add_mesh_ant_landscape.py b/add_mesh_ant_landscape.py
index 528c551a..bf12176b 100644
--- a/add_mesh_ant_landscape.py
+++ b/add_mesh_ant_landscape.py
@@ -254,7 +254,7 @@ def landscape_gen(x, y, z, falloffsize, options):
x_offset = options[24]
y_offset = options[25]
- # origin
+ # origin
if rseed == 0:
origin = 0.0 + x_offset, 0.0 + y_offset, 0.0
origin_x = x_offset
@@ -355,7 +355,7 @@ def landscape_gen(x, y, z, falloffsize, options):
elif stratatype == '3':
steps = abs(sin(value * strata * pi) * (0.1 / strata * pi))
value =(value * (1.0 - 0.5) + steps * 0.5) * 2.0
-
+
else:
value = value
@@ -474,7 +474,7 @@ class landscape_add(bpy.types.Operator):
XOffset = FloatProperty(name="X Offset",
default = 0.0,
description = "X Offset")
-
+
YOffset = FloatProperty(name="Y Offset",
default = 0.0,
description = "Y Offset")
diff --git a/animation_animall.py b/animation_animall.py
index 9a4abb74..8c9c26c0 100644
--- a/animation_animall.py
+++ b/animation_animall.py
@@ -105,20 +105,20 @@ class VIEW3D_PT_animall(bpy.types.Panel):
def poll(self, context):
if context.active_object and context.active_object.type in {'MESH', 'LATTICE', 'CURVE', 'SURFACE'}:
return context.active_object.type
-
+
# draw the gui
def draw(self, context):
-
+
Obj = context.active_object
-
+
layout = self.layout
col = layout.column(align=True)
row = col.row()
-
+
if Obj.type == 'LATTICE':
row.prop(context.window_manager, "key_points")
row.prop(context.window_manager, "key_shape")
-
+
elif Obj.type == 'MESH':
row.prop(context.window_manager, "key_points")
row.prop(context.window_manager, "key_shape")
@@ -131,35 +131,35 @@ class VIEW3D_PT_animall(bpy.types.Panel):
row.prop(context.window_manager, "key_vgroups")
row = col.row()
row.prop(context.window_manager, "key_uvs")
-
+
elif Obj.type == 'CURVE':
row.prop(context.window_manager, "key_points")
row.prop(context.window_manager, "key_shape")
row = col.row()
row.prop(context.window_manager, "key_radius")
row.prop(context.window_manager, "key_tilt")
-
+
elif Obj.type == 'SURFACE':
row.prop(context.window_manager, "key_points")
row.prop(context.window_manager, "key_shape")
row = col.row()
row.prop(context.window_manager, "key_radius")
row.prop(context.window_manager, "key_tilt")
-
+
row = col.row()
row.operator('anim.insert_keyframe_animall', icon='KEY_HLT')
row.operator('anim.delete_keyframe_animall', icon='KEY_DEHLT')
row = layout.row()
row.operator('anim.clear_animation_animall', icon='X')
-
+
if context.window_manager.key_shape:
-
+
ShapeKey = Obj.active_shape_key
ShapeKeyIndex = Obj.active_shape_key_index
-
+
split = layout.split()
row = split.row()
-
+
if ShapeKeyIndex > 0:
row.label(ShapeKey.name, icon='SHAPEKEY_DATA')
row.prop(ShapeKey, "value", text="")
@@ -171,7 +171,7 @@ class VIEW3D_PT_animall(bpy.types.Panel):
row.label('Can not key on Basis Shape', icon='ERROR')
else:
row.label('No active Shape Key', icon='ERROR')
-
+
if context.window_manager.key_points and context.window_manager.key_shape:
row = layout.row()
row.label('"Points" and "Shape" are redundant?', icon='INFO')
@@ -182,54 +182,54 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
bl_idname = 'anim.insert_keyframe_animall'
bl_description = 'Insert a Keyframe'
bl_options = {'REGISTER', 'UNDO'}
-
-
+
+
# on mouse up:
def invoke(self, context, event):
-
+
self.execute(context)
-
+
return {'FINISHED'}
def execute(op, context):
-
+
Obj = context.active_object
-
+
if Obj.type == 'MESH':
Mode = False
if context.mode == 'EDIT_MESH':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
if context.window_manager.key_shape:
if Obj.active_shape_key_index > 0:
for Vert in Obj.active_shape_key.data:
Vert.keyframe_insert('co')
-
+
if context.window_manager.key_points:
for Vert in Data.vertices:
Vert.keyframe_insert('co')
-
+
if context.window_manager.key_ebevel:
for Edge in Data.edges:
Edge.keyframe_insert('bevel_weight')
-
+
if context.window_manager.key_vbevel:
for Vert in Data.vertices:
Vert.keyframe_insert('bevel_weight')
-
+
if context.window_manager.key_crease:
for Edge in Data.edges:
Edge.keyframe_insert('crease')
-
+
if context.window_manager.key_vgroups:
for Vert in Data.vertices:
for Group in Vert.groups:
Group.keyframe_insert('weight')
-
+
if context.window_manager.key_uvs:
for UV in Data.uv_layers.active.data:
UV.keyframe_insert('uv')
@@ -239,38 +239,38 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
if VColLayer.active: # only insert in active VCol layer
for Data in VColLayer.data:
Data.keyframe_insert('color')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
-
+
if Obj.type == 'LATTICE':
Mode = False
if context.mode != 'OBJECT':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
if context.window_manager.key_shape:
if Obj.active_shape_key_index > 0:
for Point in Obj.active_shape_key.data:
Point.keyframe_insert('co')
-
+
if context.window_manager.key_points:
for Point in Data.points:
Point.keyframe_insert('co_deform')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
-
+
if Obj.type in {'CURVE', 'SURFACE'}:
Mode = False
if context.mode != 'OBJECT':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
# run this outside the splines loop (only once)
if context.window_manager.key_shape:
if Obj.active_shape_key_index > 0:
@@ -280,36 +280,36 @@ class ANIM_OT_insert_keyframe_animall(bpy.types.Operator):
CV.keyframe_insert('handle_left')
CV.keyframe_insert('handle_right')
except: pass
-
+
for Spline in Data.splines:
if Spline.type == 'BEZIER':
-
+
for CV in Spline.bezier_points:
-
+
if context.window_manager.key_points:
CV.keyframe_insert('co')
CV.keyframe_insert('handle_left')
CV.keyframe_insert('handle_right')
-
+
if context.window_manager.key_radius:
CV.keyframe_insert('radius')
-
+
if context.window_manager.key_tilt:
CV.keyframe_insert('tilt')
-
+
elif Spline.type == 'NURBS':
-
+
for CV in Spline.points:
-
+
if context.window_manager.key_points:
CV.keyframe_insert('co')
-
+
if context.window_manager.key_radius:
CV.keyframe_insert('radius')
-
+
if context.window_manager.key_tilt:
CV.keyframe_insert('tilt')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
@@ -322,8 +322,8 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
bl_idname = 'anim.delete_keyframe_animall'
bl_description = 'Delete a Keyframe'
bl_options = {'REGISTER', 'UNDO'}
-
-
+
+
# on mouse up:
def invoke(self, context, event):
@@ -333,85 +333,85 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
def execute(op, context):
-
+
Obj = context.active_object
-
+
if Obj.type == 'MESH':
Mode = False
if context.mode == 'EDIT_MESH':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
if context.window_manager.key_shape:
if Obj.active_shape_key:
for Vert in Obj.active_shape_key.data:
Vert.keyframe_delete('co')
-
+
if context.window_manager.key_points:
for Vert in Data.vertices:
Vert.keyframe_delete('co')
-
+
if context.window_manager.key_ebevel:
for Edge in Data.edges:
Edge.keyframe_delete('bevel_weight')
-
+
if context.window_manager.key_vbevel:
for Vert in Data.vertices:
Vert.keyframe_delete('bevel_weight')
-
+
if context.window_manager.key_crease:
for Edge in Data.edges:
Edge.keyframe_delete('crease')
-
+
if context.window_manager.key_vgroups:
for Vert in Data.vertices:
for Group in Vert.groups:
Group.keyframe_delete('weight')
-
+
if context.window_manager.key_uvs:
for UV in Data.uv_layers.active.data:
UV.keyframe_delete('uv')
-
+
if context.window_manager.key_vcols:
for VColLayer in Data.vertex_colors:
if VColLayer.active: # only delete in active VCol layer
for Data in VColLayer.data:
Data.keyframe_delete('color')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
if Obj.type == 'LATTICE':
-
+
Mode = False
if context.mode != 'OBJECT':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
if context.window_manager.key_shape:
if Obj.active_shape_key:
for Point in Obj.active_shape_key.data:
Point.keyframe_delete('co')
-
+
if context.window_manager.key_points:
for Point in Data.points:
Point.keyframe_delete('co_deform')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
-
+
if Obj.type in {'CURVE', 'SURFACE'}:
Mode = False
if context.mode != 'OBJECT':
Mode = not Mode
bpy.ops.object.editmode_toggle()
-
+
Data = Obj.data
-
+
# run this outside the splines loop (only once)
if context.window_manager.key_shape:
if Obj.active_shape_key_index > 0:
@@ -421,7 +421,7 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
CV.keyframe_delete('handle_left')
CV.keyframe_delete('handle_right')
except: pass
-
+
for Spline in Data.splines:
if Spline.type == 'BEZIER':
for CV in Spline.bezier_points:
@@ -433,7 +433,7 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
CV.keyframe_delete('radius')
if context.window_manager.key_tilt:
CV.keyframe_delete('tilt')
-
+
elif Spline.type == 'NURBS':
for CV in Spline.points:
if context.window_manager.key_points:
@@ -442,7 +442,7 @@ class ANIM_OT_delete_keyframe_animall(bpy.types.Operator):
CV.keyframe_delete('radius')
if context.window_manager.key_tilt:
CV.keyframe_delete('tilt')
-
+
if Mode:
bpy.ops.object.editmode_toggle()
@@ -458,16 +458,16 @@ class ANIM_OT_clear_animation_animall(bpy.types.Operator):
# on mouse up:
def invoke(self, context, event):
-
+
wm = context.window_manager
return wm.invoke_confirm(self, event)
-
-
+
+
def execute(op, context):
-
+
Data = context.active_object.data
Data.animation_data_clear()
-
+
return {'FINISHED'}
## Addons Preferences Update Panel
@@ -503,11 +503,11 @@ def register():
bpy.utils.register_module(__name__)
pass
-
+
def unregister():
bpy.utils.unregister_module(__name__)
pass
-
+
if __name__ == "__main__":
register()
diff --git a/curve_simplify.py b/curve_simplify.py
index 4ed3a5b3..6309c78e 100644
--- a/curve_simplify.py
+++ b/curve_simplify.py
@@ -40,7 +40,7 @@ import mathutils
import math
from bpy.types import Menu
-
+
## Check for curve
diff --git a/development_api_navigator.py b/development_api_navigator.py
index 14d93d6a..e7db1cf9 100644
--- a/development_api_navigator.py
+++ b/development_api_navigator.py
@@ -35,7 +35,7 @@ bl_info = {
"""
You can browse through the tree structure of the api. Each child object appears in a list
that tries to be representative of its type. These lists are :
-
+
* Items (for an iterable object)
* Item Values (for an iterable object wich only supports index)
* Modules
@@ -110,7 +110,7 @@ def get_root_module(path):
def evaluate(module):
#print('evaluate')
global root_module, tree_level, root_m_path
-
+
# path = bpy.context.window_manager.api_nav_props.path
try :
len_name = root_module.__name__.__len__()
@@ -124,13 +124,13 @@ def evaluate(module):
def get_tree_level():
#print('get_tree_level')
-
+
path = bpy.context.window_manager.api_nav_props.path
-
+
def object_list():
#print('object_list')
global current_module, root_m_path
-
+
itm, val, mod, typ, props, struct, met, att, bug = [], [], [], [], [], [], [], [], []
iterable = isiterable(current_module)
if iterable:
@@ -145,7 +145,7 @@ def get_tree_level():
val = list(current_module)
else :
val = list(current_module)
-
+
for i in dir(current_module):
try :
t = str(type(eval(root_m_path + '.' + i)))
@@ -153,7 +153,7 @@ def get_tree_level():
bug += [i]
continue
-
+
if t == "<class 'module'>":
mod += [i]
elif t[0:16] == "<class 'bpy_prop":
@@ -166,9 +166,9 @@ def get_tree_level():
typ += [i]
else :
att += [i]
-
+
return [itm, val, mod, typ, props, struct, met, att, bug]
-
+
if not path:
return [[], [], [i for i in get_root_modules()], [], [], [], [], [], []]
return object_list()
@@ -177,7 +177,7 @@ def get_tree_level():
def parent(path):
"""Returns the parent path"""
#print('parent')
-
+
parent = path
if parent[-1] == ']' and '[' in parent:
while parent[-1] != '[':
@@ -194,7 +194,7 @@ def parent(path):
def update_filter():
"""Update the filter according to the current path"""
global filter_mem
-
+
try :
bpy.context.window_manager.api_nav_props.filter = filter_mem[bpy.context.window_manager.api_nav_props.path]
except :
@@ -202,7 +202,7 @@ def update_filter():
def isiterable(mod):
-
+
try :
iter(mod)
except :
@@ -218,7 +218,7 @@ def isiterable(mod):
def fill_filter_mem():
global filter_mem
-
+
filter = bpy.context.window_manager.api_nav_props.filter
if filter:
filter_mem[bpy.context.window_manager.api_nav_props.old_path] = bpy.context.window_manager.api_nav_props.filter
@@ -230,12 +230,12 @@ def fill_filter_mem():
class ApiNavigator():
"""Parent class for API Navigator"""
-
+
@staticmethod
def generate_global_values():
"""Populate the level attributes to display the panel buttons and the documentation"""
global tree_level, current_module, module_type, return_report, last_text
-
+
text = bpy.context.space_data.text
if text:
if text.name != 'api_doc_':
@@ -250,13 +250,13 @@ class ApiNavigator():
module_type = str(type(current_module))
return_report = str(current_module)
tree_level = get_tree_level()
-
+
if tree_level.__len__() > 30:
global too_long
too_long = True
else :
too_long = False
-
+
ApiNavigator.generate_api_doc()
return {'FINISHED'}
@@ -264,7 +264,7 @@ class ApiNavigator():
def generate_api_doc():
"""Format the doc string for API Navigator"""
global current_module, api_doc_, return_report, module_type
-
+
path = bpy.context.window_manager.api_nav_props.path
line = "-" * (path.__len__()+2)
header = """\n\n\n\t\t%s\n\t %s\n\
@@ -292,14 +292,14 @@ _____________________________________________\n\
doc = current_module.__doc__
api_doc_ = header + str(doc) + footer
return {'FINISHED'}
-
+
@staticmethod
def doc_text_datablock():
"""Create the text databloc or overwrite it if it already exist"""
global api_doc_
-
+
space_data = bpy.context.space_data
-
+
try :
doc_text = bpy.data.texts['api_doc_']
space_data.text = doc_text
@@ -308,7 +308,7 @@ _____________________________________________\n\
bpy.data.texts.new(name='api_doc_')
doc_text = bpy.data.texts['api_doc_']
space_data.text = doc_text
-
+
doc_text.write(text=api_doc_)
return {'FINISHED'}
@@ -338,7 +338,7 @@ class BackToBpy(ApiNavigator, bpy.types.Operator):
"""go back to module bpy"""
bl_idname = "api_navigator.back_to_bpy"
bl_label = "Back to bpy"
-
+
def execute(self, context):
fill_filter_mem()
if not bpy.context.window_manager.api_nav_props.path:
@@ -356,16 +356,16 @@ class Down(ApiNavigator, bpy.types.Operator):
bl_idname = "api_navigator.down"
bl_label = "API Navigator Down"
pointed_module = bpy.props.StringProperty(name='Current Module', default='')
-
-
+
+
def execute(self, context):
fill_filter_mem()
-
+
if not bpy.context.window_manager.api_nav_props.path:
bpy.context.window_manager.api_nav_props.old_path = bpy.context.window_manager.api_nav_props.path = bpy.context.window_manager.api_nav_props.path + self.pointed_module
else :
bpy.context.window_manager.api_nav_props.old_path = bpy.context.window_manager.api_nav_props.path = bpy.context.window_manager.api_nav_props.path + '.' + self.pointed_module
-
+
update_filter()
self.generate_global_values()
self.doc_text_datablock()
@@ -376,18 +376,18 @@ class Parent(ApiNavigator, bpy.types.Operator):
"""go to Parent Module"""
bl_idname = "api_navigator.parent"
bl_label = "API Navigator Parent"
-
-
+
+
def execute(self, context):
path = bpy.context.window_manager.api_nav_props.path
-
+
if path:
fill_filter_mem()
bpy.context.window_manager.api_nav_props.old_path = bpy.context.window_manager.api_nav_props.path = parent(bpy.context.window_manager.api_nav_props.path)
update_filter()
self.generate_global_values()
self.doc_text_datablock()
-
+
return {'FINISHED'}
@@ -395,7 +395,7 @@ class ClearFilter(ApiNavigator, bpy.types.Operator):
"""Clear the filter"""
bl_idname = 'api_navigator.clear_filter'
bl_label = 'API Nav clear filter'
-
+
def execute(self, context):
bpy.context.window_manager.api_nav_props.filter = ''
return {'FINISHED'}
@@ -412,7 +412,7 @@ class Subscript(ApiNavigator, bpy.types.Operator):
bl_idname = "api_navigator.subscript"
bl_label = "API Navigator Subscript"
subscription = bpy.props.StringProperty(name='', default='')
-
+
def execute(self, context):
fill_filter_mem()
bpy.context.window_manager.api_nav_props.old_path = bpy.context.window_manager.api_nav_props.path = bpy.context.window_manager.api_nav_props.path + '[' + self.subscription + ']'
@@ -426,16 +426,16 @@ class Toggle_doc(ApiNavigator, bpy.types.Operator):
"""Toggle on or off api_doc_ Text"""
bl_idname = 'api_navigator.toggle_doc'
bl_label = 'Toggle api_doc_'
-
-
+
+
def execute(self, context):
global last_text
-
+
try :
if bpy.context.space_data.text.name != "api_doc_":
last_text = bpy.context.space_data.text.name
except : pass
-
+
try :
text = bpy.data.texts["api_doc_"]
bpy.data.texts["api_doc_"].clear()
@@ -443,7 +443,7 @@ class Toggle_doc(ApiNavigator, bpy.types.Operator):
except KeyError:
self.doc_text_datablock()
return {'FINISHED'}
-
+
try :
text = bpy.data.texts[last_text]
bpy.context.space_data.text = text
@@ -451,35 +451,35 @@ class Toggle_doc(ApiNavigator, bpy.types.Operator):
#bpy.ops.text.jump(line=line)
return {'FINISHED'}
except : pass
-
+
bpy.context.space_data.text = None
return {'FINISHED'}
############ UI Panels ############
-
+
class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
bl_idname = 'api_navigator'
bl_space_type = "TEXT_EDITOR"
bl_region_type = "UI"
bl_label = "API Navigator"
bl_options = {'DEFAULT_CLOSED'}
-
-
+
+
columns = 3
def iterable_draw(self):
global tree_level, current_module
-
+
iterable = isiterable(current_module)
-
+
if iterable:
iter(current_module)
current_type = str(module_type)
-
+
if current_type == "<class 'str'>":
return {'FINISHED'}
-
+
col = self.layout
# filter = bpy.context.window_manager.api_nav_props.filter # UNUSED
reduce_to = bpy.context.window_manager.api_nav_props.reduce_to * self.columns
@@ -489,7 +489,7 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
count = 0
i = 0
filtered = 0
-
+
if iterable == 'a':
current_type.__iter__()
collection = list(current_module.keys())
@@ -499,21 +499,21 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
row.label(text="Items", icon="DOTSDOWN")
box = box.box()
col = box.column(align=True)
-
+
while count < reduce_to and i < end:
mod = collection[i]
if filtered < page_index:
filtered += 1
i += 1
continue
-
+
if not (i % self.columns):
row = col.row()
row.operator('api_navigator.subscript', text=mod, emboss=False).subscription = '"' + mod + '"'
filtered += 1
i += 1
count += 1
-
+
elif iterable == 'b':
box = self.layout.box()
row = box.row()
@@ -522,23 +522,23 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
col = box.column(align=True)
collection = list(current_module)
end = collection.__len__()
-
+
while count < reduce_to and i < end:
mod = str(collection[i])
if filtered < page_index:
filtered += 1
i += 1
continue
-
+
if not (i % self.columns):
row = col.row()
row.operator('api_navigator.subscript', text=mod, emboss=False).subscription = str(i)
filtered += 1
i += 1
count += 1
-
+
too_long = end > 30
-
+
if too_long:
row = col.row()
row.prop(bpy.context.window_manager.api_nav_props, 'reduce_to')
@@ -546,40 +546,40 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
row.prop(bpy.context.window_manager.api_nav_props, 'pages', text='Pages')
return {'FINISHED'}
-
-
-
-
+
+
+
+
def list_draw(self, t, pages, icon, label=None, emboss=False):
global tree_level, current_module
-
+
def reduced(too_long):
-
+
if too_long:
row = col.row()
row.prop(bpy.context.window_manager.api_nav_props, 'reduce_to')
row.operator('api_navigator.fake_button', text='', emboss=False, icon="DOTSDOWN")
row.prop(bpy.context.window_manager.api_nav_props, 'pages', text='Pages')
-
+
layout = self.layout
-
+
filter = bpy.context.window_manager.api_nav_props.filter
-
+
reduce_to = bpy.context.window_manager.api_nav_props.reduce_to * self.columns
-
+
page_index = reduce_to*pages
-
-
+
+
len = tree_level[t].__len__()
too_long = len > reduce_to
-
+
if len:
col = layout.column()
box = col.box()
-
+
row = box.row()
row.label(text=label, icon=icon)
-
+
if t < 2:
box = box.box()
row = box.row()
@@ -588,10 +588,10 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
objects = 0
count = 0
filtered = 0
-
+
while count < reduce_to and i < len:
obj = tree_level[t][i]
-
+
if filter and filter not in obj:
i += 1
continue
@@ -599,7 +599,7 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
filtered += 1
i += 1
continue
-
+
if not (objects % self.columns):
row = col.row()
if t > 1:
@@ -612,15 +612,15 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
i += 1
objects += 1
count += 1
-
+
reduced(too_long)
-
+
return {'FINISHED'}
-
-
+
+
def draw(self, context):
global tree_level, current_module, module_type, return_report
-
+
api_update(context)
###### layout ######
@@ -628,17 +628,17 @@ class OBJECT_PT_api_navigator(ApiNavigator, bpy.types.Panel):
layout.label(text="Tree Structure:")
col = layout.column(align=True)
-
+
col.prop(bpy.context.window_manager.api_nav_props, 'path', text='')
row = col.row()
row.operator("api_navigator.parent", text="Parent", icon="BACK")
row.operator("api_navigator.back_to_bpy", text='', emboss=True, icon="FILE_PARENT")
-
+
col = layout.column()
row = col.row(align=True)
row.prop(bpy.context.window_manager.api_nav_props, 'filter')
row.operator('api_navigator.clear_filter', text='', icon='PANEL_CLOSE')
-
+
col = layout.column()
pages = bpy.context.window_manager.api_nav_props.pages
@@ -673,14 +673,14 @@ def unregister_keymaps():
def register():
from bpy.props import StringProperty, IntProperty, PointerProperty
-
+
class ApiNavProps(bpy.types.PropertyGroup):
"""
Fake module like class.
-
+
bpy.context.window_manager.api_nav_props
-
- """
+
+ """
path = StringProperty(name='path',
description='Enter bpy.ops.api_navigator to see the documentation',
default='bpy')
diff --git a/game_engine_save_as_runtime.py b/game_engine_save_as_runtime.py
index a5f4eee9..25e47d94 100644
--- a/game_engine_save_as_runtime.py
+++ b/game_engine_save_as_runtime.py
@@ -70,13 +70,13 @@ def WriteAppleRuntime(player_path, output_path, copy_python, overwrite_lib):
# Use the system's cp command to preserve some meta-data
os.system('cp -R "%s" "%s"' % (player_path, output_path))
-
+
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(output_path, "Contents/Resources/game.blend"),
relative_remap=False,
compress=False,
copy=True,
)
-
+
# Python doesn't need to be copied for OS X since it's already inside blenderplayer.app
@@ -87,22 +87,22 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls
if not os.path.isfile(player_path) and not(os.path.exists(player_path) and player_path.endswith('.app')):
report({'ERROR'}, "The player could not be found! Runtime not saved")
return
-
+
# Check if we're bundling a .app
if player_path.endswith('.app'):
WriteAppleRuntime(player_path, output_path, copy_python, overwrite_lib)
return
-
+
# Enforce "exe" extension on Windows
if player_path.endswith('.exe') and not output_path.endswith('.exe'):
output_path += '.exe'
-
+
# Get the player's binary and the offset for the blend
file = open(player_path, 'rb')
player_d = file.read()
offset = file.tell()
file.close()
-
+
# Create a tmp blend file (Blenderplayer doesn't like compressed blends)
tempdir = tempfile.mkdtemp()
blend_path = os.path.join(tempdir, bpy.path.clean_name(output_path))
@@ -111,7 +111,7 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls
compress=False,
copy=True,
)
-
+
# Get the blend data
blend_file = open(blend_path, 'rb')
blend_d = blend_file.read()
@@ -120,35 +120,35 @@ def WriteRuntime(player_path, output_path, copy_python, overwrite_lib, copy_dlls
# Get rid of the tmp blend, we're done with it
os.remove(blend_path)
os.rmdir(tempdir)
-
+
# Create a new file for the bundled runtime
output = open(output_path, 'wb')
-
+
# Write the player and blend data to the new runtime
print("Writing runtime...", end=" ")
output.write(player_d)
output.write(blend_d)
-
+
# Store the offset (an int is 4 bytes, so we split it up into 4 bytes and save it)
output.write(struct.pack('B', (offset>>24)&0xFF))
output.write(struct.pack('B', (offset>>16)&0xFF))
output.write(struct.pack('B', (offset>>8)&0xFF))
output.write(struct.pack('B', (offset>>0)&0xFF))
-
+
# Stuff for the runtime
output.write(b'BRUNTIME')
output.close()
-
+
print("done")
-
+
# Make the runtime executable on Linux
if os.name == 'posix':
os.chmod(output_path, 0o755)
-
+
# Copy bundled Python
blender_dir = os.path.dirname(bpy.app.binary_path)
runtime_dir = os.path.dirname(output_path)
-
+
if copy_python:
print("Copying Python files...", end=" ")
py_folder = os.path.join(bpy.app.version_string.split()[0], "python", "lib")
@@ -173,7 +173,7 @@ class SaveAsRuntime(bpy.types.Operator):
bl_idname = "wm.save_as_runtime"
bl_label = "Save As Game Engine Runtime"
bl_options = {'REGISTER'}
-
+
if sys.platform == 'darwin':
# XXX, this line looks suspicious, could be done better?
blender_bin_dir = '/' + os.path.join(*bpy.app.binary_path.split('/')[0:-4])
@@ -213,7 +213,7 @@ class SaveAsRuntime(bpy.types.Operator):
)
else:
copy_dlls = False
-
+
def execute(self, context):
import time
start_time = time.clock()
diff --git a/io_coat3D/coat.py b/io_coat3D/coat.py
index f80ccf5b..fc3cb747 100644
--- a/io_coat3D/coat.py
+++ b/io_coat3D/coat.py
@@ -38,9 +38,9 @@ def set_exchange_folder():
else:
exchange = os.path.expanduser("~") + os.sep + '3D-CoatV4' + os.sep + 'Exchange'
if not(os.path.isdir(exchange)):
- exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange'
+ exchange = os.path.expanduser("~") + os.sep + '3D-CoatV3' + os.sep + 'Exchange'
if(not(os.path.isdir(exchange))):
- exchange = coat3D.exchangedir
+ exchange = coat3D.exchangedir
if(os.path.isdir(exchange)):
bpy.coat3D['status'] = 1
@@ -57,7 +57,7 @@ def set_exchange_folder():
file = open(exchange_path, "w")
file.write("%s"%(coat3D.exchangedir))
file.close()
-
+
else:
if(platform == 'win32'):
exchange_path = os.path.expanduser("~") + os.sep + 'Documents' + os.sep + '3DC2Blender' + os.sep + 'Exchange_folder.txt'
@@ -92,7 +92,7 @@ def set_exchange_folder():
file = open(Blender_folder, "w")
file.close()
return exchange
-
+
def set_working_folders():
platform = os.sys.platform
coat3D = bpy.context.scene.coat3D
@@ -102,7 +102,7 @@ def set_working_folders():
if(not(os.path.isdir(folder_objects))):
os.makedirs(folder_objects)
if(not(os.path.isdir(folder_textures))):
- os.makedirs(folder_textures)
+ os.makedirs(folder_textures)
else:
folder_objects = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Objects'
folder_textures = os.path.expanduser("~") + os.sep + '3DC2Blender' + os.sep + 'Textures' + os.sep
@@ -110,8 +110,8 @@ def set_working_folders():
os.makedirs(folder_objects)
if(not(os.path.isdir(folder_textures))):
os.makedirs(folder_textures)
-
-
+
+
return folder_objects,folder_textures
class ObjectButtonsPanel():
@@ -136,7 +136,7 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
if(bpy.context.scene.objects.active):
coa = bpy.context.scene.objects.active.coat3D
-
+
if(bpy.coat3D['status'] == 0 and not(os.path.isdir(coat3D.exchangedir))):
bpy.coat3D['active_coat'] = set_exchange_folder()
row = layout.row()
@@ -145,27 +145,27 @@ class SCENE_PT_Main(ObjectButtonsPanel,bpy.types.Panel):
row.label("Please select it before using Applink.")
row = layout.row()
row.prop(coat3D,"exchangedir",text="")
-
+
else:
-
-
- #Here you add your GUI
+
+
+ #Here you add your GUI
row = layout.row()
row.prop(coat3D,"type",text = "")
row = layout.row()
colL = row.column()
colR = row.column()
-
+
colR.operator("export_applink.pilgway_3d_coat", text="Transfer")
-
+
colL.operator("import_applink.pilgway_3d_coat", text="Update")
-
-
-
-
-
+
+
+
+
+
@@ -208,7 +208,7 @@ class SCENE_OT_export(bpy.types.Operator):
object_index = 0
if(coa.applink_name and os.path.isfile(coa.applink_name)):
checkname = coa.applink_name
-
+
else:
while(looking == True):
checkname = folder_objects + os.sep + activeobj
@@ -223,7 +223,7 @@ class SCENE_OT_export(bpy.types.Operator):
coat3D.cursor_loc = obj.location
coat3D.cursor_orginal = bpy.context.scene.cursor_location
-
+
coa.loc = obj.location
coa.rot = obj.rotation_euler
@@ -233,18 +233,18 @@ class SCENE_OT_export(bpy.types.Operator):
obj.location = (0,0,0)
obj.rotation_euler = (0,0,0)
bpy.ops.object.transform_apply(scale=True)
-
+
bpy.ops.export_scene.obj(filepath=coa.applink_name,use_selection=True,
use_mesh_modifiers=False,use_blen_objects=True, use_materials = True,
keep_vertex_order = True,axis_forward='-Z',axis_up='Y')
-
+
obj.location = coa.loc
obj.rotation_euler = coa.rot
-
+
bpy.context.scene.cursor_location = coat3D.cursor_loc
bpy.context.scene.cursor_location = coat3D.cursor_orginal
-
+
file = open(importfile, "w")
file.write("%s"%(checkname))
file.write("\n%s"%(checkname))
@@ -253,9 +253,9 @@ class SCENE_OT_export(bpy.types.Operator):
file.close()
coa.objecttime = str(os.path.getmtime(coa.applink_name))
-
-
-
+
+
+
return {'FINISHED'}
class SCENE_OT_import(bpy.types.Operator):
@@ -263,7 +263,7 @@ class SCENE_OT_import(bpy.types.Operator):
bl_label = "import your custom property"
bl_description = "import your custom property"
bl_options = {'UNDO'}
-
+
def invoke(self, context, event):
scene = context.scene
coat3D = bpy.context.scene.coat3D
@@ -307,10 +307,10 @@ class SCENE_OT_import(bpy.types.Operator):
coat3D.loca = objekti.location
coat3D.rota = objekti.rotation_euler
coat3D.dime = objekti.scale
-
-
- #See if there is multres modifier.
+
+
+ #See if there is multres modifier.
for modifiers in objekti.modifiers:
if modifiers.type == 'MULTIRES' and (modifiers.total_levels > 0):
if(not(coat3D.importlevel)):
@@ -322,7 +322,7 @@ class SCENE_OT_import(bpy.types.Operator):
multires_on = True
multires_name = modifiers.name
break
-
+
exportfile = coat3D.exchangedir
path3b_n = coat3D.exchangedir
path3b_n += ('last_saved_3b_file.txt')
@@ -340,8 +340,8 @@ class SCENE_OT_import(bpy.types.Operator):
delete_material = False
else:
delete_material = True
-
-
+
+
if(not(objekti.active_material) and objekti.material_slots):
act_mat_index = objekti.active_material_index
materials_old = bpy.data.materials.keys()
@@ -351,29 +351,29 @@ class SCENE_OT_import(bpy.types.Operator):
new_mat = new_ma[0]
ki = bpy.data.materials[new_mat]
objekti.material_slots[act_mat_index].material = ki
-
-
+
+
if(os.path.isfile(path_object) and (coa.objecttime != str(os.path.getmtime(path_object)))):
if(objekti.material_slots):
act_mat_index = objekti.active_material_index
for obj_mat in objekti.material_slots:
mat_list.append(obj_mat.material)
-
+
coa.dime = objekti.dimensions
coa.objecttime = str(os.path.getmtime(path_object))
mtl = coa.applink_name
mtl = mtl.replace('.obj','.mtl')
if(os.path.isfile(mtl)):
os.remove(mtl)
-
+
bpy.ops.import_scene.obj(filepath=path_object,axis_forward='-Z',axis_up='Y',use_image_search=False)
obj_proxy = scene.objects[0]
bpy.ops.object.select_all(action='TOGGLE')
obj_proxy.select = True
-
-
+
+
bpy.ops.object.transform_apply(rotation=True)
proxy_mat = obj_proxy.material_slots[0].material
if(delete_material):
@@ -392,21 +392,21 @@ class SCENE_OT_import(bpy.types.Operator):
bpy.ops.object.select_all(action='TOGGLE')
multires_on = False
else:
-
+
scene.objects.active = obj_proxy
-
+
obj_data = objekti.data.id_data
objekti.data = obj_proxy.data.id_data
if(bpy.data.meshes[obj_data.name].users == 0):
objekti.data.id_data.name = obj_data.name
bpy.data.meshes.remove(obj_data)
-
+
obj_proxy.select = True
bpy.ops.object.delete()
objekti.select = True
objekti.scale = coat3D.dime
-
+
bpy.context.scene.objects.active = objekti
if(os.path.isfile(path3b_n)):
@@ -415,7 +415,7 @@ class SCENE_OT_import(bpy.types.Operator):
objekti.coat3D.path3b = lin
path3b_fil.close()
os.remove(path3b_n)
-
+
if(coat3D.importmesh and not(os.path.isfile(path_object))):
coat3D.importmesh = False
@@ -423,7 +423,7 @@ class SCENE_OT_import(bpy.types.Operator):
for mat_one in mat_list:
objekti.data.materials.append(mat_one)
objekti.active_material_index = act_mat_index
-
+
if(mat_list):
for obj_mate in objekti.material_slots:
if(hasattr(obj_mate.material,'texture_slots')):
@@ -432,8 +432,8 @@ class SCENE_OT_import(bpy.types.Operator):
if(tex_slot.texture.type == 'IMAGE'):
if tex_slot.texture.image is not None:
tex_slot.texture.image.reload()
-
-
+
+
if(coat3D.importtextures):
export = ''
tex.gettex(mat_list,objekti,scene,export)
@@ -452,8 +452,8 @@ class SCENE_OT_import(bpy.types.Operator):
objekti.modifiers[multires_name].filepath = multires
#bpy.ops.object.multires_external_pack()
bpy.ops.object.shade_smooth()
-
-
+
+
for act_name in test:
act_name.select = True
bpy.context.scene.objects.active = act_first
@@ -461,36 +461,36 @@ class SCENE_OT_import(bpy.types.Operator):
if(new_object == True):
coat3D = bpy.context.scene.coat3D
scene = context.scene
-
+
Blender_folder = ("%s%sBlender"%(coat3D.exchangedir,os.sep))
Blender_export = Blender_folder
path3b_now = coat3D.exchangedir
path3b_now += ('last_saved_3b_file.txt')
Blender_export += ('%sexport.txt'%(os.sep))
-
+
mat_list = []
obj_path =''
-
+
export = new_applink_name
mod_time = os.path.getmtime(new_applink_name)
mtl_list = new_applink_name.replace('.obj','.mtl')
if(os.path.isfile(mtl_list)):
os.remove(mtl_list)
-
+
bpy.ops.import_scene.obj(filepath=new_applink_name,axis_forward='-Z',axis_up='Y')
bpy.ops.object.transform_apply(rotation=True)
new_obj = scene.objects[0]
new_obj.coat3D.applink_name = obj_path
scene.objects[0].coat3D.applink_name = export #objectdir muutettava
-
+
os.remove(Blender_export)
-
+
bpy.context.scene.objects.active = new_obj
bpy.ops.object.shade_smooth()
-
+
Blender_tex = ("%s%stextures.txt"%(coat3D.exchangedir,os.sep))
mat_list.append(new_obj.material_slots[0].material)
tex.gettex(mat_list, new_obj, scene,export)
@@ -558,11 +558,11 @@ class VIEW3D_MT_Coat_Dynamic_Menu(bpy.types.Menu):
layout.separator()
else:
if(os.path.isfile(Blender_export)):
-
+
layout.operator("import3b_applink.pilgway_3d_coat", text="Bring from 3D-Coat")
layout.separator()
-
+
class VIEW3D_MT_ImportMenu(bpy.types.Menu):
bl_label = "Import Settings"
@@ -575,7 +575,7 @@ class VIEW3D_MT_ImportMenu(bpy.types.Menu):
layout.prop(coat3D,"importmod")
layout.prop(coat3D,"smooth_on")
layout.prop(coat3D,"importtextures")
-
+
class VIEW3D_MT_ExportMenu(bpy.types.Menu):
bl_label = "Export Settings"
diff --git a/io_coat3D/tex.py b/io_coat3D/tex.py
index 5bdbdca9..f532177c 100644
--- a/io_coat3D/tex.py
+++ b/io_coat3D/tex.py
@@ -32,17 +32,17 @@ def gettex(mat_list, objekti, scene,export):
coat3D = bpy.context.scene.coat3D
coa = objekti.coat3D
-
+
if(bpy.context.scene.render.engine == 'VRAY_RENDER' or bpy.context.scene.render.engine == 'VRAY_RENDER_PREVIEW'):
vray = True
else:
vray = False
-
+
take_color = 0
take_spec = 0
take_normal = 0
take_disp = 0
-
+
bring_color = 1
bring_spec = 1
bring_normal = 1
@@ -75,7 +75,7 @@ def gettex(mat_list, objekti, scene,export):
just_nimi = ko + '_'
just_nimi_len = len(just_nimi)
print('terve:' + coa.applink_name)
-
+
if(len(objekti.material_slots) != 0):
for obj_tex in objekti.active_material.texture_slots:
if(hasattr(obj_tex,'texture')):
@@ -88,13 +88,13 @@ def gettex(mat_list, objekti, scene,export):
bring_normal = 0;
if(obj_tex.use_map_displacement):
bring_disp = 0;
-
+
files = os.listdir(osoite)
for i in files:
tui = i[:just_nimi_len]
if(tui == just_nimi):
texu.append(i)
-
+
for yy in texu:
minimi = (yy.rfind('_'))+1
maksimi = (yy.rfind('.'))
@@ -112,14 +112,14 @@ def gettex(mat_list, objekti, scene,export):
new_mat = new_ma[0]
ki = bpy.data.materials[new_mat]
objekti.data.materials.append(ki)
-
+
if(bring_color == 1 and texcoat['color']):
index = find_index(objekti)
tex = bpy.ops.Texture
objekti.active_material.texture_slots.create(index)
total_mat = len(objekti.active_material.texture_slots.items())
useold = ''
-
+
for seekco in bpy.data.textures:
if((seekco.name[:5] == 'Color') and (seekco.users_material == ())):
useold = seekco
@@ -136,19 +136,19 @@ def gettex(mat_list, objekti, scene,export):
bpy.ops.image.new(name=name_tex)
bpy.data.images[name_tex].filepath = texcoat['color'][0]
bpy.data.images[name_tex].source = 'FILE'
-
+
objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex]
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex]
-
+
if(objekti.data.uv_textures.active):
objekti.active_material.texture_slots[index].texture_coords = 'UV'
objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name
objekti.active_material.texture_slots[index].texture.image.reload()
-
+
elif(useold != ''):
-
+
objekti.active_material.texture_slots[index].texture = useold
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name]
objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['color'][0]
@@ -156,14 +156,14 @@ def gettex(mat_list, objekti, scene,export):
objekti.active_material.texture_slots[index].texture_coords = 'UV'
objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name
-
+
if(bring_normal == 1 and texcoat['nmap']):
index = find_index(objekti)
tex = bpy.ops.Texture
objekti.active_material.texture_slots.create(index)
total_mat = len(objekti.active_material.texture_slots.items())
useold = ''
-
+
for seekco in bpy.data.textures:
if((seekco.name[:6] == 'Normal') and (seekco.users_material == ())):
useold = seekco
@@ -179,10 +179,10 @@ def gettex(mat_list, objekti, scene,export):
bpy.ops.image.new(name=name_tex)
bpy.data.images[name_tex].filepath = texcoat['nmap'][0]
bpy.data.images[name_tex].source = 'FILE'
-
+
objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex]
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex]
-
+
if(objekti.data.uv_textures.active):
objekti.active_material.texture_slots[index].texture_coords = 'UV'
objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name
@@ -199,10 +199,10 @@ def gettex(mat_list, objekti, scene,export):
objekti.active_material.texture_slots[index].normal_map_space = 'TANGENT'
objekti.active_material.texture_slots[index].normal_factor = 1
-
+
elif(useold != ''):
-
+
objekti.active_material.texture_slots[index].texture = useold
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name]
objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['nmap'][0]
@@ -217,10 +217,10 @@ def gettex(mat_list, objekti, scene,export):
if(bring_spec == 1 and texcoat['specular']):
index = find_index(objekti)
-
+
objekti.active_material.texture_slots.create(index)
useold = ''
-
+
for seekco in bpy.data.textures:
if((seekco.name[:8] == 'Specular') and (seekco.users_material == ())):
useold = seekco
@@ -239,7 +239,7 @@ def gettex(mat_list, objekti, scene,export):
objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex]
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex]
-
+
if(objekti.data.uv_textures.active):
objekti.active_material.texture_slots[index].texture_coords = 'UV'
objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name
@@ -248,10 +248,10 @@ def gettex(mat_list, objekti, scene,export):
objekti.active_material.texture_slots[index].use_map_specular = True
objekti.active_material.texture_slots[index].texture.image.reload()
-
+
elif(useold != ''):
-
+
objekti.active_material.texture_slots[index].texture = useold
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name]
objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['specular'][0]
@@ -264,11 +264,11 @@ def gettex(mat_list, objekti, scene,export):
if(bring_disp == 1 and texcoat['disp']):
index = find_index(objekti)
-
+
objekti.active_material.texture_slots.create(index)
useold = ''
-
+
for seekco in bpy.data.textures:
if((seekco.name[:12] == 'Displacement') and (seekco.users_material == ())):
useold = seekco
@@ -284,10 +284,10 @@ def gettex(mat_list, objekti, scene,export):
bpy.ops.image.new(name=name_tex)
bpy.data.images[name_tex].filepath = texcoat['disp'][0]
bpy.data.images[name_tex].source = 'FILE'
-
+
objekti.active_material.texture_slots[index].texture = bpy.data.textures[name_tex]
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[name_tex]
-
+
if(objekti.data.uv_textures.active):
objekti.active_material.texture_slots[index].texture_coords = 'UV'
objekti.active_material.texture_slots[index].uv_layer = objekti.data.uv_textures.active.name
@@ -299,7 +299,7 @@ def gettex(mat_list, objekti, scene,export):
elif(useold != ''):
-
+
objekti.active_material.texture_slots[index].texture = useold
objekti.active_material.texture_slots[index].texture.image = bpy.data.images[useold.name]
objekti.active_material.texture_slots[index].texture.image.filepath = texcoat['disp'][0]
diff --git a/io_convert_image_to_mesh_img/import_img.py b/io_convert_image_to_mesh_img/import_img.py
index 68caab8d..303991dc 100644
--- a/io_convert_image_to_mesh_img/import_img.py
+++ b/io_convert_image_to_mesh_img/import_img.py
@@ -599,7 +599,7 @@ class hirise_dtm_importer(object):
# iterator of faces, each faces contains three or more indices to
# the *vertices* argument. eg: [(5, 6, 8, 9), (1, 2, 3), ...]
#:type faces: iterable object
- me.from_pydata(coords, [], faces)
+ me.from_pydata(coords, [], faces)
# me.vertices.add(len(coords)/3)
# me.vertices.foreach_set("co", coords)
@@ -655,7 +655,7 @@ class hirise_dtm_importer(object):
if self.__cropXY:
image_iter = self.cropXY(image_iter,
- XSize=self.__cropXY[0],
+ XSize=self.__cropXY[0],
YSize=self.__cropXY[1],
XOffset=self.__cropXY[2],
YOffset=self.__cropXY[3]
diff --git a/io_export_dxf/draw_blenders/__init__.py b/io_export_dxf/draw_blenders/__init__.py
index 06e5e20f..e2a7d030 100644
--- a/io_export_dxf/draw_blenders/__init__.py
+++ b/io_export_dxf/draw_blenders/__init__.py
@@ -58,7 +58,7 @@ def curve_drawBlender(vertList, org_point=[0.0,0.0,0.0], closed=0, name="dxfCurv
ob.setLocation(cur_loc)
Blender.Redraw()
#return ob
-
+
#-----------------------------------------------------
def drawClipBox(clip_box):
"""debug tool: draws Clipping-Box of a Camera View
@@ -79,7 +79,7 @@ def drawClipBox(clip_box):
newmesh = Mesh.New()
newmesh.verts.extend(verts)
newmesh.faces.extend(faces)
-
+
plan = Object.New('Mesh','clip_box')
plan.link(newmesh)
sce = Scene.GetCurrent()
diff --git a/io_export_dxf/export_dxf.py b/io_export_dxf/export_dxf.py
index fb53e4dd..89aa1d1c 100644
--- a/io_export_dxf/export_dxf.py
+++ b/io_export_dxf/export_dxf.py
@@ -6,7 +6,7 @@ if DEBUG:
import sys
sys.path.append(os.environ['PYDEV_DEBUG_PATH'])
import pydevd
-
+
from .model.migiusModel import MigiusDXFLibDrawing
SUPPORTED_TYPES = ('MESH')#,'CURVE','EMPTY','TEXT','CAMERA','LAMP')
@@ -28,7 +28,7 @@ def exportDXF(context, filePath, settings):
objects = (ob for ob in scene.objects if ob.is_visible(scene) and ob.select and ob.type in SUPPORTED_TYPES)
else:
objects = (ob for ob in scene.objects if ob.is_visible(scene) and ob.type in SUPPORTED_TYPES)
-
+
if DEBUG: pydevd.settrace()
mw = get_view_projection_matrix(context, settings)
@@ -37,22 +37,22 @@ def exportDXF(context, filePath, settings):
#todo: fixme: seems to be the reason for missing BLOCK-export
#if APPLY_MODIFIERS: tmp_me = Mesh.New('tmp')
#else: tmp_me = None
-
+
drawing = MigiusDXFLibDrawing()
exported = 0
for o in objects:
if _exportItem(context, o, mw, drawing, settings):
exported +=1
-
+
if not drawing.isEmpty():
# NOTE: Only orthographic projection used now.
# if PERSPECTIVE: # generate view border - passepartout
# from .primitive_exporters.viewborder_exporter import ViewBorderDXFExporter
# e = ViewBorderDXFExporter(settings)
# e.export(drawing, ob, mx, mw)
-
+
drawing.convert(filePath)
-
+
duration = time.clock() - time1
print('%s objects exported in %.2f seconds. -----DONE-----' %\
(exported, duration))
@@ -75,7 +75,7 @@ def getCommons(ob, settings):
thickness=None
parent=None
"""
-
+
BYBLOCK=0 #DXF-attribute: assign property to BLOCK defaults
BYLAYER=None #256 #DXF-attribute: assign property to LAYER defaults
LAYERNAME_DEF='' #default layer name
@@ -94,7 +94,7 @@ def getCommons(ob, settings):
ob_material = materials[0]
ob_mat_color = ob_material.material.diffuse_color
else: ob_mat_color, ob_material = None, None
- if DEBUG:
+ if DEBUG:
print('ob_mat_color, ob_material=', ob_mat_color, ob_material) #--------------
data_materials = ob.material_slots
@@ -202,7 +202,7 @@ def get_view_projection_matrix(context, settings):
Projection matrix is either identity if 3d export is selected or
camera projection if a camera or view is selected.
Currently only orthographic projection is used. (Subject to discussion).
- """
+ """
cam = settings['projectionThrough']
if cam == None:
mw = mathutils.Matrix()
diff --git a/io_export_dxf/model/dxfLibrary.py b/io_export_dxf/model/dxfLibrary.py
index c1730d4d..1d917e25 100644
--- a/io_export_dxf/model/dxfLibrary.py
+++ b/io_export_dxf/model/dxfLibrary.py
@@ -278,7 +278,7 @@ class Face(_Entity):
while len(points)<4: #fix for r12 format
points.append(points[-1])
self.points=points
-
+
def __str__(self):
out = ' 0\n3DFACE\n%s%s\n' %(self._common(),_points(self.points))
return out
@@ -579,7 +579,7 @@ class LineType(_Call):
elements += ' 49\n%s\n' %e
result += elements
return result
-
+
#-----------------------------------------------
class Style(_Call):
@@ -767,16 +767,16 @@ class Drawing(_Collection):
#self.acadver='9\n$ACADVER\n1\nAC1006\n'
self.acadver=' 9\n$ACADVER\n 1\nAC1009\n'
"""DXF AutoCAD-Release format codes:
- AC1021 2008, 2007
- AC1018 2006, 2005, 2004
- AC1015 2002, 2000i, 2000
- AC1014 R14,14.01
- AC1012 R13
- AC1009 R12,11
- AC1006 R10
- AC1004 R9
- AC1002 R2.6
- AC1.50 R2.05
+ AC1021 2008, 2007
+ AC1018 2006, 2005, 2004
+ AC1015 2002, 2000i, 2000
+ AC1014 R14,14.01
+ AC1012 R13
+ AC1009 R12,11
+ AC1006 R10
+ AC1004 R9
+ AC1002 R2.6
+ AC1.50 R2.05
"""
def _name(self,x):
@@ -815,7 +815,7 @@ class Drawing(_Collection):
entities=self._section('entities',[str(x) for x in self.entities])
all=''.join([header,tables,blocks,entities,' 0\nEOF\n'])
return all
-
+
def _write_section(self,file,name,data):
file.write(' 0\nSECTION\n 2\n%s\n'%name.upper())
for x in data:
@@ -924,4 +924,4 @@ if __name__=='__main__':
if not copy:
Draw.PupMenu('Error%t|This script requires a full python install')
else: test()
-
+
diff --git a/io_export_dxf/model/migiusModel.py b/io_export_dxf/model/migiusModel.py
index a1e8b830..10344767 100644
--- a/io_export_dxf/model/migiusModel.py
+++ b/io_export_dxf/model/migiusModel.py
@@ -13,7 +13,7 @@ try:
#from dxfLibrary import *
except Exception:
raise Exception("No dxfLibrary.py module in Blender script folder found!")
-
+
#------------------------------------------------------
#def col2RGB(color):
# return [int(floor(255*color[0])),
@@ -81,13 +81,13 @@ class MigiusDXFLibDrawing(DxfDrawing):
# for l in self._layers:
drawing.saveas(file)
- def _write(self):
+ def _write(self):
# init Drawing ---------------------
d=DXF.Drawing()
# add Tables -----------------
# initialized automatic: d.blocks.append(b) #section BLOCKS
# initialized automatic: d.styles.append(DXF.Style()) #table STYLE
-
+
#table LTYPE ---------------
#d.linetypes.append(DXF.LineType(name='CONTINUOUS',description='--------',elements=[0.0]))
d.linetypes.append(DXF.LineType(name='DOT',description='. . . . . . .',elements=[0.25, 0.0, -0.25]))
@@ -97,13 +97,13 @@ class MigiusDXFLibDrawing(DxfDrawing):
d.linetypes.append(DXF.LineType(name='BORDER',description='__ __ . __ __ . ',elements=[1.75, 0.5, -0.25, 0.5, -0.25, 0.0, -0.25]))
d.linetypes.append(DXF.LineType(name='HIDDEN',description='__ __ __ __ __',elements=[0.4, 0.25, -0.25]))
d.linetypes.append(DXF.LineType(name='CENTER',description='____ _ ____ _ __',elements=[2.0, 1.25, -0.25, 0.25, -0.25]))
-
+
#d.vports.append(DXF.VPort('*ACTIVE'))
d.vports.append(DXF.VPort('*ACTIVE',center=(-5.0,1.0),height=10.0))
#d.vports.append(DXF.VPort('*ACTIVE',leftBottom=(-100.0,-60.0),rightTop=(100.0,60.0)))
#d.views.append(DXF.View('Normal')) #table view
d.views.append(DXF.ViewByWindow('BF_TOPVIEW',leftBottom=(-100,-60),rightTop=(100,60))) #idem
-
+
return d
def _processEntityArray(self, drawing, type, ents):
diff --git a/io_export_dxf/model/model.py b/io_export_dxf/model/model.py
index bff37339..53fef13b 100644
--- a/io_export_dxf/model/model.py
+++ b/io_export_dxf/model/model.py
@@ -10,7 +10,7 @@ class DxfDrawing(object):
self._views = []
self._vports = []
self._blocks = []
-
+
def isEmpty(self):
return len(self._entities) == 0
@@ -34,5 +34,5 @@ class DxfDrawing(object):
def convert(self, **kwargs):
""" Converts this drawing into DXF representation object """
raise NotImplementedError()
-
+
diff --git a/io_export_dxf/operator.py b/io_export_dxf/operator.py
index b5d8d089..3ba7de60 100644
--- a/io_export_dxf/operator.py
+++ b/io_export_dxf/operator.py
@@ -67,7 +67,7 @@ class DXFExporter(bpy.types.Operator):
('..BLOCK', '..BLOCK', ''),
('..XDATA', '..XDATA', ''),
('..INI-File', '..INI-File', '')
- )
+ )
projectionItems=(
('NO', 'No projection', 'Export 3D scene without any 2D projection'),
('TOP', 'TOP view', 'Use TOP view for projection'),
@@ -150,10 +150,10 @@ class DXFExporter(bpy.types.Operator):
projectionThrough = EnumProperty(name="Projection", default="NO",
description="Select camera for use to 2D projection",
items=projectionItems)
-
+
onlySelected = BoolProperty(name="Only selected", default=True,
description="What object will be exported? Only selected / all objects")
-
+
apply_modifiers = BoolProperty(name="Apply modifiers", default=True,
description="Shall be modifiers applied during export?")
# GUI_B -----------------------------------------
@@ -225,7 +225,7 @@ class DXFExporter(bpy.types.Operator):
# description='Set default COLOR. (0=BYBLOCK,256=BYLAYER)')
# layerltype_def = StringProperty(name="Default LINETYPE", default="DEF_LAY_TYPE",
# description='Set default LINETYPE')
-
+
verbose = BoolProperty(name="Verbose", default=False,
description="Run the exporter in debug mode. Check the console for output")
@@ -249,9 +249,9 @@ class DXFExporter(bpy.types.Operator):
'entitylayer_from' : self.entitylayer_from,
'entitycolor_from' : self.entitycolor_from,
- 'entityltype_from' : self.entityltype_from,
+ 'entityltype_from' : self.entityltype_from,
'layerName_from' : self.layerName_from,
-
+
# NOT USED
# 'layFrozen_on' : self.layFrozen_on,
# 'materialFilter_on' : self.materialFilter_on,
diff --git a/io_export_dxf/primitive_exporters/__init__.py b/io_export_dxf/primitive_exporters/__init__.py
index 8e49ba00..d1cfad46 100644
--- a/io_export_dxf/primitive_exporters/__init__.py
+++ b/io_export_dxf/primitive_exporters/__init__.py
@@ -6,5 +6,5 @@ that is being exported from export_dxf.py in ../
NOTE: Only MESH exporter has been ported since it is imho
mostly used. I am not specialist on Autocad so I cannot
guest how many time the other primitive are used. That's
-why they are left unported.
+why they are left unported.
"""
diff --git a/io_export_dxf/primitive_exporters/base_exporter.py b/io_export_dxf/primitive_exporters/base_exporter.py
index b85dc127..2542a1c0 100644
--- a/io_export_dxf/primitive_exporters/base_exporter.py
+++ b/io_export_dxf/primitive_exporters/base_exporter.py
@@ -1,14 +1,14 @@
import mathutils
class BasePrimitiveDXFExporter(object):
-
+
INSTANCES = False
PROJECTION = False
HIDDEN_LINES = False
-
+
def __init__(self, settings):
self._settings = settings
-
+
def projected_co(self, verts, matrix):
""" converts coordinates of points from OCS to WCS->ScreenCS
needs matrix: a projection matrix
@@ -18,11 +18,11 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:projected_co() verts=', verts #---------
temp_verts = [matrix*mathutils.Vector(v) for v in verts]
#print 'deb:projected_co() temp_verts=', temp_verts #---------
-
+
# if GUI_A['Z_force_on'].val: locZ = GUI_A['Z_elev'].val
# else:locZ = 0.0
locZ = 0.0
-
+
if self.PROJECTION:
if self.PERSPECTIVE:
clipStart = 10.0
@@ -36,7 +36,7 @@ class BasePrimitiveDXFExporter(object):
temp_verts = [v[:3] for v in temp_verts]
#print 'deb:projected_co() out_verts=', temp_verts #---------
return temp_verts
-
+
def isLeftHand(self, matrix):
#Is the matrix a left-hand-system, or not?
ma = matrix.to_euler().to_matrix()
@@ -44,7 +44,7 @@ class BasePrimitiveDXFExporter(object):
check = self.M_DotVecs(ma[2], crossXY)
if check < 0.00001: return 1
return 0
-
+
#-----------------------------------------------------
def hidden_status(self, faces, mx, mx_n):
# sort out back-faces = with normals pointed away from camera
@@ -63,8 +63,8 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:2vec_normal=', vec_normal #------------------
#vec_normal *= mw0.rotationPart()
#print 'deb:3vec_normal=', vec_normal, '\n' #------------------
-
-
+
+
frontFace = False
if not self.PERSPECTIVE: #for ortho mode ----------
# normal must point the Z direction-hemisphere
@@ -75,14 +75,14 @@ class BasePrimitiveDXFExporter(object):
vert = mathutils.Vector(v.co) * mx
if mathutils.DotVecs(vert, vec_normal) < 0.00001:
frontFace = True
-
+
if frontFace:
front_faces.append(f.index)
for key in f.edge_keys:
#this test can be done faster with set()
if key not in front_edges:
front_edges.append(key)
-
+
#print 'deb: amount of visible faces=', len(front_faces) #---------
#print 'deb: visible faces=', front_faces #---------
#print 'deb: amount of visible edges=', len(front_edges) #---------
@@ -100,7 +100,7 @@ class BasePrimitiveDXFExporter(object):
# p[1] += G_ORIGIN[1]
# p[2] += G_ORIGIN[2]
return points
-
+
#---- migration to 2.49-------------------------------------------------
#Draw.PupMenu('DXF exporter: Abort%t|This script version works for Blender up 2.49 only!')
@@ -109,12 +109,12 @@ class BasePrimitiveDXFExporter(object):
return v1.cross(v2) #for up2.49
else:
return mathutils.CrossVecs(v1,v2) #for pre2.49
-
+
def M_DotVecs(self, v1,v2):
if 'cross' in dir(mathutils.Vector()):
return v1.dot(v2) #for up2.49
else:
- return mathutils.DotVecs(v1,v2) #for pre2.49
+ return mathutils.DotVecs(v1,v2) #for pre2.49
#-----------------------------------------------------
def getExtrusion(self, matrix):
@@ -134,18 +134,18 @@ class BasePrimitiveDXFExporter(object):
#print 'deb:\n' #-------------
#print 'deb:getExtrusion() Extrusion=', Extrusion #---------
return Extrusion, AXaxis.normalize()
-
+
#-----------------------------------------------------
# def getZRotation(AXaxis, rot_matrix_invert):
# """calculates ZRotation = angle between ArbitraryXvector and obj.matrix.Xaxis
-#
+#
# """
# # this works: Xaxis is the obj.matrix-Xaxis vector
# # but not correct for all orientations
# #Xaxis = matrix[0].copy().resize3D() # = ArbitraryXvector
# ##Xaxis.normalize() # = ArbitraryXvector
# #ZRotation = - mathutils.AngleBetweenVecs(Xaxis,AXaxis) #output in radians
-#
+#
# # this works for all orientations, maybe a bit faster
# # transform AXaxis into OCS:Object-Coord-System
# #rot_matrix = normalizeMat(matrix.rotationPart())
@@ -155,11 +155,11 @@ class BasePrimitiveDXFExporter(object):
# ##vec.normalize() # not needed for atan2()
# #print '\ndeb:getExtrusion() vec=', vec #---------
# ZRotation = - atan2(vec[1],vec[0]) #output in radians
-#
+#
# #print 'deb:ZRotation() ZRotation=', ZRotation*r2d #---------
# return ZRotation
-#
-#
+#
+#
# #-----------------------------------------------------
# def getTargetOrientation(mx,Extrusion,AXaxis,WCS_loc,sizeX,sizeY,sizeZ,rotX,rotY,rotZ):
# """given
@@ -175,11 +175,11 @@ class BasePrimitiveDXFExporter(object):
# else: #TODO: to check, why below rot_matrix_invert is not equal above one
# rot_euler_matrix = euler2matrix(rotX,rotY,rotZ)
# rot_matrix_invert = euler2matrix(-rotX,-rotY,-rotZ)
-#
+#
# # OCS_origin is Global_Origin in ObjectCoordSystem
# OCS_origin = mathutils.Vector(WCS_loc) * rot_matrix_invert
# #print 'deb: OCS_origin=', OCS_origin #---------
-#
+#
# ZRotation = rotZ
# if Extrusion!=None:
# ZRotation = getZRotation(AXaxis,rot_matrix_invert)
@@ -187,7 +187,7 @@ class BasePrimitiveDXFExporter(object):
# rs, rc = sin(ZRotation), cos(ZRotation)
# Zrotmatrix = mathutils.Matrix([rc, rs,0.0],[-rs,rc,0.0],[0.0,0.0,1.0])
# #print 'deb: Zrotmatrix=\n', Zrotmatrix #--------------
-#
+#
# # ECS_origin is Global_Origin in EntityCoordSystem
# ECS_origin = OCS_origin * Zrotmatrix
# #print 'deb: ECS_origin=', ECS_origin #---------
diff --git a/io_export_dxf/primitive_exporters/curve_exporter.py b/io_export_dxf/primitive_exporters/curve_exporter.py
index d74a459f..09372cad 100644
--- a/io_export_dxf/primitive_exporters/curve_exporter.py
+++ b/io_export_dxf/primitive_exporters/curve_exporter.py
@@ -32,7 +32,7 @@ def exportCurve(ob, mx, mw, **common):
if not PROJECTION:
#Extrusion, ZRotation, Elevation = getExtrusion(mx)
Extrusion, AXaxis = getExtrusion(imx)
-
+
# no thickness/width for POLYLINEs converted into Screen-C-S
#print 'deb: curve.ext1=', curve.ext1 #---------
if curve.ext1: Thickness = curve.ext1 * sizeZ
@@ -66,7 +66,7 @@ def exportCurve(ob, mx, mw, **common):
rotY = ob.RotY
rotZ = ob.RotZ
#print 'deb: sizeX=%s, sizeY=%s' %(sizeX, sizeY) #---------
-
+
Thickness,Extrusion,ZRotation,Elevation = None,None,None,None
ZRotation,Zrotmatrix,OCS_origin,ECS_origin = None,None,None,None
AXaxis = mx[0].copy().resize3D() # = ArbitraryXvector
@@ -74,7 +74,7 @@ def exportCurve(ob, mx, mw, **common):
if not PROJECTION:
#Extrusion, ZRotation, Elevation = getExtrusion(mx)
Extrusion, AXaxis = getExtrusion(mx)
-
+
# no thickness/width for POLYLINEs converted into Screen-C-S
#print 'deb: curve.ext1=', curve.ext1 #---------
if curve.ext1: Thickness = curve.ext1 * sizeZ
@@ -174,7 +174,7 @@ def writeCurveEntities(curve, mx,
#print 'deb: pkt=', pkt #---------
points.append(pkt)
flags.append([None, [width1,width2]])
-
+
#print 'deb: points', points #--------------
if len(points)>1:
c = curve_as_list[GUI_A['curve_as'].val]
@@ -192,13 +192,13 @@ def writeCurveEntities(curve, mx,
else:
points = projected_co(points, mx)
#print 'deb: points', points #--------------
-
+
if cur.isCyclic(): closed = 1
else: closed = 0
points = toGlobalOrigin(points)
points_temp = []
for p,f in zip(points,flags):
- points_temp.append([p,f[0],f[1]])
+ points_temp.append([p,f[0],f[1]])
points = points_temp
#print 'deb: points', points #--------------
@@ -209,7 +209,7 @@ def writeCurveEntities(curve, mx,
##common['elevation']= Elevation
common['thickness']= Thickness
#print 'deb: common=', common #------------------
-
+
flag70, flag75 = pflag70+closed, pflag75
if 0: #DEBUG
p=AXaxis[:3]
@@ -222,20 +222,20 @@ def writeCurveEntities(curve, mx,
#OCS_origin=[0,0,0] #only debug----------------
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
-
+
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
if Thickness:
common['thickness']= -Thickness
dxfPLINE = DXF.PolyLine(points,OCS_origin, flag70=flag70, flag75=flag70, width=0.0,**common)
entities.append(dxfPLINE)
-
+
elif c=="LINEs": # export Curve as multiple LINEs
points = projected_co(points, mx)
if cur.isCyclic(): points.append(points[0])
#print 'deb: points', points #--------------
points = toGlobalOrigin(points)
-
+
if DEBUG: curve_drawBlender(points,WCS_loc,closed) #deb: draw to scene
common['extrusion']= Extrusion
common['elevation']= Elevation
@@ -251,7 +251,7 @@ def writeCurveEntities(curve, mx,
linepoints = [points[i], points[i+1]]
dxfLINE = DXF.Line(linepoints,**common)
entities.append(dxfLINE)
-
+
elif c=="POINTs": # export Curve as multiple POINTs
points = projected_co(points, mx)
for p in points:
diff --git a/io_export_dxf/primitive_exporters/insert_exporter.py b/io_export_dxf/primitive_exporters/insert_exporter.py
index 80cf7dbd..46382e3d 100644
--- a/io_export_dxf/primitive_exporters/insert_exporter.py
+++ b/io_export_dxf/primitive_exporters/insert_exporter.py
@@ -43,7 +43,7 @@ def exportInsert(ob, mx, insert_name, **common):
#TODO: ? sizeX *= coef
#sizeY *= coef
#sizeZ *= coef
-
+
#print 'deb: point=', point #--------------
[point] = toGlobalOrigin([point])
diff --git a/io_export_dxf/primitive_exporters/mesh_exporter.py b/io_export_dxf/primitive_exporters/mesh_exporter.py
index 9764796b..69834871 100644
--- a/io_export_dxf/primitive_exporters/mesh_exporter.py
+++ b/io_export_dxf/primitive_exporters/mesh_exporter.py
@@ -4,7 +4,7 @@ from .base_exporter import BasePrimitiveDXFExporter
import copy
class MeshDXFExporter(BasePrimitiveDXFExporter):
-
+
def export(self, ctx, drawing, ob, mx, mx_n, **kwargs):
"""
Converts Mesh-Object to desired projection and representation(DXF-Entity type)
@@ -15,7 +15,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# it manipulates original geometry and by retransformation lefts back rounding-errors
# we dont want to manipulate original data!
#temp_verts = me.verts[:] #doesn't work on ubuntu(Yorik), bug?
- if me.vertices:
+ if me.vertices:
# check if there are more instances of this mesh (if used by other objects), then write to BLOCK/INSERT
if self.INSTANCES and me.users>1 and not self.PROJECTION and not (ob.modifiers and self._settings['apply_modifiers']):
if drawing.containsBlock(me.name):
@@ -40,15 +40,15 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# block = DXF.Block(insert_name,flag=0,base=(0,0,0),entities=entities)
# write INSERT as entity
entities = self._writeInsert(ob, mx, me.name, **(kwargs))
-
+
else: # no other instances, so go the standard way
return self._standard_way(drawing, me, mx, mx_n)
-
+
def _writeInsert(self, drawing, ob, mx, insert_name, **kwargs):
from insert_exporter import InsertDXFExporter
ex = InsertDXFExporter(self._settings)
ex.export(drawing, ob, mx, insert_name, **(kwargs))
-
+
def _getMeshData(self, ctx, obj, settings):
if obj.modifiers and settings['apply_modifiers']:
#this gets mesh with applied modifiers
@@ -57,7 +57,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
# me = ob.getData(mesh=1) # is a Mesh if mesh>0 (otherwise it is a NMesh)
data = obj.data
return data
-
+
def _standard_way(self, drawing, me, mx, mx_n, **kwargs):
allpoints = [v.co for v in me.vertices]
allpoints = self.projected_co(allpoints, mx)
@@ -92,7 +92,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
for type, args in entities:
drawing.addEntity(type, **(args))
return True
-
+
def _writeMeshEntities(self, allpoints, edges, faces, **kwargs):
"""help routine for exportMesh()
"""
@@ -115,7 +115,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
elif c in {'POLYFACE', 'POLYLINE'}:
if faces and allpoints:
#TODO: purge allpoints: left only vertices used by faces
-# if exportsettings['verbose']:
+# if exportsettings['verbose']:
# mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
if not (self.PROJECTION and self.HIDDEN_LINES):
faces = [[v+1 for v in f.vertices] for f in faces]
@@ -129,7 +129,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
i,newverts=0,[]
for used_i,used in enumerate(verts_state):
if used:
- newverts.append(allpoints[used_i])
+ newverts.append(allpoints[used_i])
map[used_i]=i
i+=1
allpoints = newverts
@@ -142,7 +142,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
entities.append(('PolyLine', args))
elif c=='3DFACEs':
if faces and allpoints:
-# if exportsettings['verbose']:
+# if exportsettings['verbose']:
# mesh_drawBlender(allpoints, None, faces) #deb: draw to scene
for f in faces:
points = [allpoints[v_id] for v_id in f.vertices]
diff --git a/io_export_dxf/primitive_exporters/text_exporter.py b/io_export_dxf/primitive_exporters/text_exporter.py
index 98693aec..52d19725 100644
--- a/io_export_dxf/primitive_exporters/text_exporter.py
+++ b/io_export_dxf/primitive_exporters/text_exporter.py
@@ -60,7 +60,7 @@ def exportText(ob, mx, mw, **common):
coef = -clipStart / (point1*mx)[2]
textHeight *= coef
#print 'deb: coef=', coef #--------------
-
+
#print 'deb: point=', point #--------------
[point] = toGlobalOrigin([point])
point2 = point
diff --git a/io_import_dxf/dxfgrabber/styles.py b/io_import_dxf/dxfgrabber/styles.py
index 3d5dc5e0..5d056f31 100644
--- a/io_import_dxf/dxfgrabber/styles.py
+++ b/io_import_dxf/dxfgrabber/styles.py
@@ -50,7 +50,7 @@ class StyleTable(Table):
style = Style(entry_tags)
styles._table_entries[style.name] = style
return styles
-
+
DEFAULT_STYLE = """ 0
STYLE
diff --git a/io_import_gimp_image_to_scene.py b/io_import_gimp_image_to_scene.py
index 8f1a1ede..c554e518 100644
--- a/io_import_gimp_image_to_scene.py
+++ b/io_import_gimp_image_to_scene.py
@@ -36,12 +36,12 @@ This script imports GIMP layered image files into 3D Scenes (.xcf, .xjt)
def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
LayerScale, OpacityMode, AlphaMode, ShadelessMats,
SetCamera, SetupCompo, GroupUntagged, Ext):
-
+
#-------------------------------------------------
-
+
#Folder = '['+File.rstrip(Ext)+']'+'_images/'
Folder = 'images_'+'['+File.rstrip(Ext)+']/'
-
+
if not bpy.data.is_saved:
PathSaveRaw = Path+Folder
PathSave = PathSaveRaw.replace(' ', '\ ')
@@ -55,7 +55,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
try: os.mkdir(PathSaveRaw)
except: pass
PathSaveRaw = bpy.path.relpath(PathSaveRaw)+'/'
-
+
PathRaw = Path
Path = Path.replace(' ', '\ ')
if Ext == '.xjt':
@@ -63,92 +63,92 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
#-------------------------------------------------
# EXTRACT XJT
import tarfile
-
+
IMG = tarfile.open ('%s%s' % (PathRaw, File))
PRP = IMG.extractfile('PRP')
-
+
Members = IMG.getmembers()
-
+
for Member in Members:
Name = Member.name
if Name.startswith('l') and Name.endswith('.jpg'):
IMG.extract(Name, path=PathSaveRaw)
-
+
#-------------------------------------------------
# INFO XJT
IMGs = []
for Line in PRP.readlines():
Line = str(Line)
-
+
if Line.startswith("b'GIMP_XJ_IMAGE"):
for Segment in Line.split():
if Segment.startswith('w/h:'):
ResX, ResY = map (int, Segment[4:].split(','))
if Line.startswith(("b'L", "b'l")):
-
+
"""The "nice" method to check if layer has alpha channel
sadly GIMP sometimes decides not to export an alpha channel
if it's pure white so we are not completly sure here yet"""
if Line.startswith("b'L"): HasAlpha = True
else: HasAlpha = False
-
+
md = None
op = 1
ox, oy = 0,0
-
+
for Segment in Line.split():
-
+
if Segment.startswith("b'"):
imageFile = 'l' + Segment[3:] + '.jpg'
imageFileAlpha ='la'+Segment[3:]+'.jpg'
-
+
"""Phisically double checking if alpha image exists
now we can be sure! (damn GIMP)"""
if HasAlpha:
if not os.path.isfile(PathSaveRaw+imageFileAlpha): HasAlpha = False
-
+
# Get Widht and Height from images
data = open(PathSaveRaw+imageFile, "rb").read()
-
+
hexList = []
for ch in data:
byt = "%02X" % ch
hexList.append(byt)
-
+
for k in range(len(hexList)-1):
if hexList[k] == 'FF' and (hexList[k+1] == 'C0' or hexList[k+1] == 'C2'):
ow = int(hexList[k+7],16)*256 + int(hexList[k+8],16)
oh = int(hexList[k+5],16)*256 + int(hexList[k+6],16)
-
+
elif Segment.startswith('md:'): # mode
md = Segment[3:]
-
+
elif Segment.startswith('op:'): # opacity
op = float(Segment[3:])*.01
-
+
elif Segment.startswith('o:'): # origin
ox, oy = map(int, Segment[2:].split(','))
-
+
elif Segment.startswith('n:'): # name
n = Segment[3:-4]
OpenBracket = n.find ('[')
CloseBracket = n.find (']')
-
+
if OpenBracket != -1 and CloseBracket != -1:
RenderLayer = n[OpenBracket+1:CloseBracket]
NameShort = n[:OpenBracket]
-
+
else:
RenderLayer = n
NameShort = n
-
+
os.rename(PathSaveRaw+imageFile, PathSaveRaw+NameShort+'.jpg')
if HasAlpha: os.rename(PathSaveRaw+imageFileAlpha, PathSaveRaw+NameShort+'_A'+'.jpg')
-
+
IMGs.append({'LayerMode':md, 'LayerOpacity':op,
'LayerName':n, 'LayerNameShort':NameShort,
'RenderLayer':RenderLayer, 'LayerCoords':[ow, oh, ox, oy], 'HasAlpha':HasAlpha})
-
+
else: # Ext == '.xcf':
ExtSave = '.png'
#-------------------------------------------------
@@ -171,14 +171,14 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
IMGs = []
for Line in Info.split('\n'):
if Line.startswith ('+'):
-
+
Line = Line.split(' ', 4)
-
+
RenderLayer = Line[4]
-
+
OpenBracket = RenderLayer.find ('[')
CloseBracket = RenderLayer.find (']')
-
+
if OpenBracket != -1 and CloseBracket != -1:
RenderLayer = RenderLayer[OpenBracket+1:CloseBracket]
NameShort = Line[4][:OpenBracket]
@@ -188,7 +188,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
RenderLayer = '__Undefined__'
else:
RenderLayer = NameShort
-
+
LineThree = Line[3]
Slash = LineThree.find('/')
if Slash == -1:
@@ -197,7 +197,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
else:
Mode = LineThree[:Slash]
Opacity = float(LineThree[Slash+1:LineThree.find('%')])*.01
-
+
IMGs.append ({
'LayerMode': Mode,
'LayerOpacity': Opacity,
@@ -209,7 +209,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
})
elif Line.startswith('Version'):
ResX, ResY = map (int, Line.split()[2].split('x'))
-
+
#-------------------------------------------------
# EXTRACT XCF
if OpacityMode == 'BAKE':
@@ -220,56 +220,56 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
for Layer in IMGs:
png_path = "%s%s.png" % (PathSave, Layer['LayerName'].replace(' ', '_'))
subprocess.call((XCF2PNG, "-C", xcf_path, "-o", png_path, Layer['LayerName']) + Opacity)
-
+
#-------------------------------------------------
Scene = bpy.context.scene
#-------------------------------------------------
# CAMERA
-
+
if SetCamera:
bpy.ops.object.camera_add(location=(0, 0, 10))
-
+
Camera = bpy.context.active_object.data
-
+
Camera.type = 'ORTHO'
Camera.ortho_scale = ResX * .01
-
+
#-------------------------------------------------
# RENDER SETTINGS
-
+
Render = Scene.render
-
+
if SetCamera:
Render.resolution_x = ResX
Render.resolution_y = ResY
Render.resolution_percentage = 100
Render.alpha_mode = 'TRANSPARENT'
-
+
#-------------------------------------------------
# 3D VIEW SETTINGS
-
+
Scene.game_settings.material_mode = 'GLSL'
-
+
Areas = bpy.context.screen.areas
-
+
for Area in Areas:
if Area.type == 'VIEW_3D':
Area.spaces.active.viewport_shade = 'TEXTURED'
Area.spaces.active.show_textured_solid = True
Area.spaces.active.show_floor = False
-
+
#-------------------------------------------------
# 3D LAYERS
-
+
def Make3DLayer (Name, NameShort, Z, Coords, RenderLayer, LayerMode, LayerOpacity, HasAlpha):
-
+
# RenderLayer
-
+
if SetupCompo:
if not bpy.context.scene.render.layers.get(RenderLayer):
-
+
bpy.ops.scene.render_layer_add()
-
+
LayerActive = bpy.context.scene.render.layers.active
LayerActive.name = RenderLayer
LayerActive.use_pass_vector = True
@@ -277,18 +277,18 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
LayerActive.use_edge_enhance = False
LayerActive.use_strand = False
LayerActive.use_halo = False
-
+
global LayerNum
for i in range (0,20):
if not i == LayerNum:
LayerActive.layers[i] = False
-
+
bpy.context.scene.layers[LayerNum] = True
-
+
LayerFlags[RenderLayer] = bpy.context.scene.render.layers.active.layers
-
+
LayerList.append([RenderLayer, LayerMode, LayerOpacity])
-
+
LayerNum += 1
# Object
@@ -298,40 +298,40 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
-
+
Active = bpy.context.active_object
-
+
if SetupCompo:
Active.layers = LayerFlags[RenderLayer]
-
+
Active.location = (
(float(Coords[2])-(ResX*0.5))*LayerScale,
(-float(Coords[3])+(ResY*0.5))*LayerScale, Z)
-
+
for Vert in Active.data.vertices:
Vert.co[0] += 1
Vert.co[1] += -1
-
+
Active.dimensions = float(Coords[0])*LayerScale, float(Coords[1])*LayerScale, 0
-
+
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
-
+
bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')
-
+
Active.show_wire = True
-
+
Active.name = NameShort
bpy.ops.mesh.uv_texture_add()
-
+
# Material
-
+
'''if bpy.data.materials.get(NameShort):
Mat = bpy.data.materials[NameShort]
if not Active.material_slots:
bpy.ops.object.material_slot_add()
Active.material_slots[0].material = Mat
else:'''
-
+
Mat = bpy.data.materials.new(NameShort)
Mat.diffuse_color = (1,1,1)
Mat.use_raytrace = False
@@ -343,23 +343,23 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
if OpacityMode == 'MAT': Mat.alpha = LayerOpacity
else: Mat.alpha = 0
if ShadelessMats: Mat.use_shadeless = True
-
+
if Ext == '.xcf':
# Color & Alpha PNG
Tex = bpy.data.textures.new(NameShort, 'IMAGE')
Tex.extension = 'CLIP'
Tex.use_preview_alpha = True
-
+
Img = bpy.data.images.new(NameShort, 128, 128)
Img.source = 'FILE'
Img.alpha_mode = AlphaMode
Img.filepath = '%s%s%s' % (PathSaveRaw, Name, ExtSave)
-
+
UVFace = Active.data.uv_textures[0].data[0]
UVFace.image = Img
-
+
Tex.image = Img
-
+
Mat.texture_slots.add()
TexSlot = Mat.texture_slots[0]
TexSlot.texture = Tex
@@ -367,40 +367,40 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
TexSlot.texture_coords = 'UV'
if OpacityMode == 'TEX': TexSlot.alpha_factor = LayerOpacity
elif OpacityMode == 'MAT': TexSlot.blend_type = 'MULTIPLY'
-
+
else: # Ext == '.xjt'
# Color JPG
Tex = bpy.data.textures.new(NameShort, 'IMAGE')
Tex.extension = 'CLIP'
-
+
Img = bpy.data.images.new(NameShort, 128, 128)
Img.source = 'FILE'
Img.filepath = '%s%s%s' % (PathSaveRaw, Name, ExtSave)
-
+
UVFace = Active.data.uv_textures[0].data[0]
UVFace.image = Img
-
+
Tex.image = Img
-
+
Mat.texture_slots.add()
TexSlot = Mat.texture_slots[0]
TexSlot.texture = Tex
TexSlot.texture_coords = 'UV'
-
+
if HasAlpha:
# Alpha JPG
Tex = bpy.data.textures.new(NameShort+'_A', 'IMAGE')
Tex.extension = 'CLIP'
Tex.use_preview_alpha = True
-
+
Img = bpy.data.images.new(NameShort+'_A', 128, 128)
Img.source = 'FILE'
Img.alpha_mode = AlphaMode
Img.filepath = '%s%s_A%s' % (PathSaveRaw, Name, ExtSave)
Img.use_alpha = False
-
+
Tex.image = Img
-
+
Mat.texture_slots.add()
TexSlot = Mat.texture_slots[1]
TexSlot.texture = Tex
@@ -409,10 +409,10 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
TexSlot.texture_coords = 'UV'
if OpacityMode == 'TEX': TexSlot.alpha_factor = LayerOpacity
elif OpacityMode == 'MAT': TexSlot.blend_type = 'MULTIPLY'
-
+
if not Active.material_slots:
bpy.ops.object.material_slot_add()
-
+
Active.material_slots[0].material = Mat
@@ -421,7 +421,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
LayerNum = 0
LayerFlags = {}
LayerList = []
-
+
for Layer in IMGs:
Make3DLayer(Layer['LayerName'].replace(' ', '_'),
Layer['LayerNameShort'].replace(' ', '_'),
@@ -432,57 +432,57 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
Layer['LayerOpacity'],
Layer['HasAlpha'],
)
-
+
Z -= LayerOffset
-
+
if SetupCompo:
#-------------------------------------------------
# COMPO NODES
-
+
Scene.use_nodes = True
-
+
Tree = Scene.node_tree
-
+
for i in Tree.nodes:
Tree.nodes.remove(i)
-
+
LayerList.reverse()
-
+
Offset = 0
LayerLen = len(LayerList)
-
+
for Layer in LayerList:
-
+
Offset += 1
-
+
X_Offset = (500*Offset)
Y_Offset = (-300*Offset)
-
+
Node = Tree.nodes.new('CompositorNodeRLayers')
Node.location = (-500+X_Offset, 300+Y_Offset)
Node.name = 'R_'+ str(Offset)
Node.scene = Scene
Node.layer = Layer[0]
-
+
if LayerViewers:
Node_V = Tree.nodes.new('CompositorNodeViewer')
Node_V.name = Layer[0]
Node_V.location = (-200+X_Offset, 200+Y_Offset)
-
+
Tree.links.new(Node.outputs[0], Node_V.inputs[0])
-
+
if LayerLen > Offset:
-
+
Mode = LayerList[Offset][1] # has to go one step further
LayerOpacity = LayerList[Offset][2]
-
+
if not Mode in {'Normal', '-1'}:
-
+
Node = Tree.nodes.new('CompositorNodeMixRGB')
if OpacityMode == 'COMPO': Node.inputs['Fac'].default_value = LayerOpacity
else: Node.inputs['Fac'].default_value = 1
Node.use_alpha = True
-
+
if Mode in {'Addition', '7'}: Node.blend_type = 'ADD'
elif Mode in {'Subtract', '8'}: Node.blend_type = 'SUBTRACT'
elif Mode in {'Multiply', '3'}: Node.blend_type = 'MULTIPLY'
@@ -500,27 +500,27 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
elif Mode in {'Hue', '11'}: Node.blend_type = 'HUE'
elif Mode in {'Softlight', '19'}: Node.blend_type = 'SOFT_LIGHT'
else: pass
-
+
else:
Node = Tree.nodes.new('CompositorNodeAlphaOver')
if OpacityMode == 'COMPO': Node.inputs['Fac'].default_value = LayerOpacity
Node.name = 'M_' + str(Offset)
Node.location = (300+X_Offset, 250+Y_Offset)
-
+
if MixerViewers:
Node_V = Tree.nodes.new('CompositorNodeViewer')
Node_V.name = Layer[0]
Node_V.location = (500+X_Offset, 350+Y_Offset)
-
+
Tree.links.new(Node.outputs[0], Node_V.inputs[0])
-
+
else:
Node = Tree.nodes.new('CompositorNodeComposite')
Node.name = 'Composite'
Node.location = (400+X_Offset, 350+Y_Offset)
-
+
Nodes = bpy.context.scene.node_tree.nodes
-
+
if LayerLen > 1:
for i in range (1, LayerLen + 1):
if i == 1:
@@ -533,7 +533,7 @@ def main(report, File, Path, LayerViewers, MixerViewers, LayerOffset,
Tree.links.new(Nodes['M_'+str(i-1)].outputs[0], Nodes['Composite'].inputs[0])
else:
Tree.links.new(Nodes['R_1'].outputs[0], Nodes['Composite'].inputs[0])
-
+
for i in Tree.nodes:
i.location[0] += -250*Offset
i.location[1] += 150*Offset
@@ -553,20 +553,20 @@ class GIMPImageToScene(bpy.types.Operator):
bl_label = "GIMP Image to Scene"
bl_description = "Imports GIMP multilayer image files into 3D Scenes"
bl_options = {'REGISTER', 'UNDO'}
-
+
filename = StringProperty(name="File Name",
description="Name of the file")
directory = StringProperty(name="Directory",
description="Directory of the file")
-
+
LayerViewers = BoolProperty(name="Layer Viewers",
description="Add Viewer nodes to each Render Layer node",
default=True)
-
+
MixerViewers = BoolProperty(name="Mixer Viewers",
description="Add Viewer nodes to each Mix node",
default=True)
-
+
AlphaMode = EnumProperty(name="Alpha Mode",
description="Representation of alpha information in the RGBA pixels",
items=(
@@ -577,7 +577,7 @@ class GIMPImageToScene(bpy.types.Operator):
ShadelessMats = BoolProperty(name="Shadeless Material",
description="Set Materials as Shadeless",
default=True)
-
+
OpacityMode = EnumProperty(name="Opacity Mode",
description="Layer Opacity management",
items=(
@@ -586,32 +586,32 @@ class GIMPImageToScene(bpy.types.Operator):
('COMPO', 'Mixer Node Factor', ''),
('BAKE', 'Baked in Image Alpha', '')),
default='TEX')
-
+
SetCamera = BoolProperty(name="Set Camera",
description="Create an Ortho Camera matching image resolution",
default=True)
-
+
SetupCompo = BoolProperty(name="Setup Node Compositing",
description="Create a compositing node setup (will delete existing nodes)",
default=False)
-
+
GroupUntagged = BoolProperty(name="Group Untagged",
description="Layers with no tag go to a single Render Layer",
default=False)
-
+
LayerOffset = FloatProperty(name="Layer Separation",
description="Distance between each 3D Layer in the Z axis",
min=0,
default=0.50)
-
+
LayerScale = FloatProperty(name="Layer Scale",
description="Scale pixel resolution by Blender units",
min=0,
default=0.01)
-
+
def draw(self, context):
layout = self.layout
-
+
box = layout.box()
box.label('3D Layers:', icon='SORTSIZE')
box.prop(self, 'SetCamera', icon='OUTLINER_DATA_CAMERA')
@@ -622,7 +622,7 @@ class GIMPImageToScene(bpy.types.Operator):
box.prop(self, 'ShadelessMats', icon='SOLID')
box.prop(self, 'LayerOffset')
box.prop(self, 'LayerScale')
-
+
box = layout.box()
box.label('Compositing:', icon='RENDERLAYERS')
box.prop(self, 'SetupCompo', icon='NODETREE')
@@ -630,12 +630,12 @@ class GIMPImageToScene(bpy.types.Operator):
box.prop(self, 'GroupUntagged', icon='IMAGE_ZDEPTH')
box.prop(self, 'LayerViewers', icon='NODE')
box.prop(self, 'MixerViewers', icon='NODE')
-
+
def execute(self, context):
# File Path
filename = self.filename
directory = self.directory
-
+
# Settings
LayerViewers = self.LayerViewers
MixerViewers = self.MixerViewers
@@ -647,11 +647,11 @@ class GIMPImageToScene(bpy.types.Operator):
GroupUntagged = self.GroupUntagged
LayerOffset = self.LayerOffset
LayerScale = self.LayerScale
-
+
Ext = None
if filename.endswith('.xcf'): Ext = '.xcf'
elif filename.endswith('.xjt'): Ext = '.xjt'
-
+
# Call Main Function
if Ext:
ret = main(self.report, filename, directory, LayerViewers, MixerViewers, LayerOffset,
@@ -662,7 +662,7 @@ class GIMPImageToScene(bpy.types.Operator):
else:
self.report({'ERROR'},"Selected file wasn't valid, try .xcf or .xjt")
return {'CANCELLED'}
-
+
return {'FINISHED'}
def invoke(self, context, event):
diff --git a/io_import_scene_unreal_psa_psk.py b/io_import_scene_unreal_psa_psk.py
index 045ef471..4eaa8a72 100644
--- a/io_import_scene_unreal_psa_psk.py
+++ b/io_import_scene_unreal_psa_psk.py
@@ -137,7 +137,7 @@ def gettailpos(pbone,bones):
ischildfound = True
childbone = bone
childbonelist.append(bone)
-
+
if ischildfound:
tmp_head = [0.0] * 3
for bone in childbonelist:
@@ -187,9 +187,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
#read general header
indata = unpack('20s3i', pskfile.read(32))
#not using the general header at this time
- #==================================================================================================
+ #==================================================================================================
# vertex point
- #==================================================================================================
+ #==================================================================================================
#read the PNTS0000 header
indata = unpack('20s3i', pskfile.read(32))
recCount = indata[3]
@@ -207,9 +207,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
printlog(str(indata[0]) + "|" + str(indata[1]) + "|" + str(indata[2]) + "\n")
#Tmsh.vertices.append(NMesh.Vert(indata[0], indata[1], indata[2]))
- #==================================================================================================
+ #==================================================================================================
# UV
- #==================================================================================================
+ #==================================================================================================
#read the VTXW0000 header
indata = unpack('20s3i', pskfile.read(32))
recCount = indata[3]
@@ -227,9 +227,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
#print([indata[0], indata[2], indata[3]])
#print([indata[1], indata[2], indata[3]])
- #==================================================================================================
+ #==================================================================================================
# Face
- #==================================================================================================
+ #==================================================================================================
#read the FACE0000 header
indata = unpack('20s3i', pskfile.read(32))
recCount = indata[3]
@@ -288,9 +288,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
# skip something...
#==========
- #==================================================================================================
+ #==================================================================================================
# Material
- #==================================================================================================
+ #==================================================================================================
##
#read the MATT0000 header
indata = unpack('20s3i', pskfile.read(32))
@@ -307,9 +307,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
print("Mat name %s", indata[0])
##
- #==================================================================================================
+ #==================================================================================================
# Bones (Armature)
- #==================================================================================================
+ #==================================================================================================
#read the REFSKEL0 header
indata = unpack('20s3i', pskfile.read(32))
recCount = indata[3]
@@ -321,8 +321,8 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
md5_bones = []
bni_dict = {}
- #==================================================================================================
- # Bone Data
+ #==================================================================================================
+ # Bone Data
#==================================================================================================
counter = 0
print ("---PRASE--BONES---")
@@ -364,7 +364,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
else:
createbone.bindmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix()
createbone.origmat = mathutils.Quaternion((indata[7], -indata[4], -indata[5], -indata[6])).to_matrix()
-
+
createbone.bindmat = mathutils.Matrix.Translation(mathutils.Vector((indata[8], indata[9], indata[10]))) * \
createbone.bindmat.to_4x4()
@@ -378,13 +378,13 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
for pbone in md5_bones:
if pbone.name != pbone.parent.name:
- pbone.bindmat = pbone.parent.bindmat * pbone.bindmat
+ pbone.bindmat = pbone.parent.bindmat * pbone.bindmat
#print(pbone.name)
#print(pbone.bindmat)
#print("end")
else:
pbone.bindmat = pbone.bindmat
-
+
for pbone in md5_bones:
pbone.head = getheadpos(pbone, md5_bones)
@@ -479,7 +479,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
newbone.tail.z = bone.tail[2]
newbone.roll = math.radians(90.0)
"""
- vec = newbone.tail - newbone.head
+ vec = newbone.tail - newbone.head
if vec.z > 0.0:
newbone.roll = math.radians(90.0)
else:
@@ -515,9 +515,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
#Add the material to the mesh
VtxCol.append(tmpCol)
- #==================================================================================================
+ #==================================================================================================
# Bone Weight
- #==================================================================================================
+ #==================================================================================================
#read the RAWW0000 header
indata = unpack('20s3i', pskfile.read(32))
recCount = indata[3]
@@ -562,9 +562,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
"""
if (DEBUGLOG):
logf.close()
- #==================================================================================================
+ #==================================================================================================
#Building Mesh
- #==================================================================================================
+ #==================================================================================================
print("vertex:", len(verts), "faces:", len(faces))
print("vertex2:", len(verts2))
me_ob.vertices.add(len(verts2))
@@ -617,7 +617,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
#===================================================================================================
print ("-------------------------")
print ("-- Creating UV Texture --")
- print ("-------------------------")
+ print ("-------------------------")
texture = []
# texturename = "text1" # UNUSED
countm = 0
@@ -644,9 +644,9 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
_uv3 = mfaceuv[0][2] #(0,0)
uv.data[face.index].uv3 = mathutils.Vector((_uv3[0], _uv3[1])) #set them
else: #if not match zero them
- uv.data[face.index].uv1 = mathutils.Vector((0, 0)) #zero them
- uv.data[face.index].uv2 = mathutils.Vector((0, 0)) #zero them
- uv.data[face.index].uv3 = mathutils.Vector((0, 0)) #zero them
+ uv.data[face.index].uv1 = mathutils.Vector((0, 0)) #zero them
+ uv.data[face.index].uv2 = mathutils.Vector((0, 0)) #zero them
+ uv.data[face.index].uv3 = mathutils.Vector((0, 0)) #zero them
_textcount += 1
#_matcount += 1
#print(matcount)
@@ -697,7 +697,7 @@ def pskimport(infile,importmesh,importbone,bDebugLogPSK,importmultiuvtextures):
#bpy.ops.object.select_name(name=str(ob_new.name))
#bpy.context.scene.objects.active = ob_new
me_ob.update()
- bpy.context.scene.objects.link(obmesh)
+ bpy.context.scene.objects.link(obmesh)
bpy.context.scene.update()
obmesh.select = False
ob_new.select = False
@@ -978,7 +978,7 @@ def psaimport(filename,context):
if pbone.parent != None:
quat = quat.conjugated()
mat = Matrix.Translation(pos) * quat.to_matrix().to_4x4()
- mat = pose_bones[bName].parent.matrix * mat
+ mat = pose_bones[bName].parent.matrix * mat
#mat = pbone.parent.Transform * mat
else:
mat = pbone.Transform * Matrix.Translation(pos) * quat.to_matrix().to_4x4()
@@ -1012,16 +1012,16 @@ def psaimport(filename,context):
pose_bone.keyframe_insert("location")
pose_bone.keyframe_insert("rotation_quaternion")
bpy.context.scene.update()
- #set back children bon to original position
+ #set back children bon to original position
#reverse whirl child bone by quat.inverse()
for child in childrens:
armmat = children_infos[child][0]
pos = children_infos[child][1]
- rotmat = children_infos[child][2]
+ rotmat = children_infos[child][2]
- child.matrix = Matrix.Translation(pos) * rotmat.to_4x4() * hymat * armmat
- child.keyframe_insert("location")
+ child.matrix = Matrix.Translation(pos) * rotmat.to_4x4() * hymat * armmat
+ child.keyframe_insert("location")
child.keyframe_insert("rotation_quaternion")
for bone in pose_bones:
@@ -1284,6 +1284,6 @@ def unregister():
if __name__ == "__main__":
register()
-#note this only read the data and will not be place in the scene
-#getInputFilename('C:\\blenderfiles\\BotA.psk')
+#note this only read the data and will not be place in the scene
+#getInputFilename('C:\\blenderfiles\\BotA.psk')
#getInputFilename('C:\\blenderfiles\\AA.PSK')
diff --git a/io_mesh_pdb/export_pdb.py b/io_mesh_pdb/export_pdb.py
index 81b60cb9..d0eb07eb 100644
--- a/io_mesh_pdb/export_pdb.py
+++ b/io_mesh_pdb/export_pdb.py
@@ -20,7 +20,7 @@ import bpy
from . import import_pdb
-class AtomPropExport(object):
+class AtomPropExport(object):
__slots__ = ('element', 'location')
def __init__(self, element, location):
self.element = element
@@ -31,13 +31,13 @@ def export_pdb(obj_type, filepath_pdb):
list_atoms = []
for obj in bpy.context.selected_objects:
-
+
if "Stick" in obj.name:
continue
-
+
if obj.type not in {'MESH', 'SURFACE', 'META'}:
- continue
-
+ continue
+
name = ""
for element in import_pdb.ELEMENTS_DEFAULT:
if element[1] in obj.name:
@@ -45,7 +45,7 @@ def export_pdb(obj_type, filepath_pdb):
name = "X"
else:
name = element[2]
-
+
if name == "":
if obj_type == "0":
name = "?"
diff --git a/io_mesh_pdb/import_pdb.py b/io_mesh_pdb/import_pdb.py
index 3ca3b51f..a7a0be7d 100644
--- a/io_mesh_pdb/import_pdb.py
+++ b/io_mesh_pdb/import_pdb.py
@@ -167,7 +167,7 @@ class ElementProp(object):
self.radii_ionic = radii_ionic
# This is the class, which stores the properties of one atom.
-class AtomProp(object):
+class AtomProp(object):
__slots__ = ('element', 'name', 'location', 'radius', 'color', 'material')
def __init__(self, element, name, location, radius, color, material):
self.element = element
@@ -187,10 +187,10 @@ class StickProp(object):
self.dist = dist
# -----------------------------------------------------------------------------
-# Some basic routines
+# Some basic routines
-# The function, which reads all necessary properties of the elements.
+# The function, which reads all necessary properties of the elements.
def read_elements():
del ELEMENTS[:]
@@ -208,7 +208,7 @@ def read_elements():
ELEMENTS.append(li)
-# The function, which reads the x,y,z positions of all atoms in a PDB
+# The function, which reads the x,y,z positions of all atoms in a PDB
# file.
#
# filepath_pdb: path to pdb file
@@ -250,39 +250,39 @@ def read_pdb_file(filepath_pdb, radiustype):
color = [0,0,0]
location = Vector((0,0,0))
# Append the TER into the list. Material remains empty so far.
- all_atoms.append(AtomProp(short_name,
- name,
- location,
+ all_atoms.append(AtomProp(short_name,
+ name,
+ location,
radius,
color,[]))
-
+
# If 'ATOM or 'HETATM' appears in the line then do ...
elif "ATOM" in line or "HETATM" in line:
# What follows is due to deviations which appear from PDB to
# PDB file. It is very special!
- #
+ #
# PLEASE, DO NOT CHANGE! ............................... from here
if line[12:13] == " " or line[12:13].isdigit() == True:
short_name = line[13:14]
if line[14:15].islower() == True:
- short_name = short_name + line[14:15]
+ short_name = short_name + line[14:15]
elif line[12:13].isupper() == True:
short_name = line[12:13]
if line[13:14].isalpha() == True:
short_name = short_name + line[13:14]
else:
- print("Atomic Blender: Strange error in PDB file.\n"
+ print("Atomic Blender: Strange error in PDB file.\n"
"Look for element names at positions 13-16 and 78-79.\n")
return -1
-
+
if len(line) >= 78:
-
+
if line[76:77] == " ":
short_name2 = line[76:77]
else:
short_name2 = line[76:78]
-
+
if short_name2.isalpha() == True:
FOUND = False
for element in ELEMENTS:
@@ -292,7 +292,7 @@ def read_pdb_file(filepath_pdb, radiustype):
if FOUND == False:
short_name = short_name2
# ....................................................... to here.
-
+
# Go through all elements and find the element of the current atom.
FLAG_FOUND = False
for element in ELEMENTS:
@@ -415,29 +415,29 @@ def read_pdb_file_sticks(filepath_pdb, use_sticks_bonds, all_atoms):
# For all the other atoms in the list do:
for atom2 in atom_list[1:]:
-
+
if use_sticks_bonds == True:
number = atom_list[1:].count(atom2)
-
+
if number == 2 or number == 3:
basis_list = list(set(atom_list[1:]))
-
+
if len(basis_list) > 1:
- basis1 = (all_atoms[atom1-1].location
+ basis1 = (all_atoms[atom1-1].location
- all_atoms[basis_list[0]-1].location)
- basis2 = (all_atoms[atom1-1].location
- - all_atoms[basis_list[1]-1].location)
+ basis2 = (all_atoms[atom1-1].location
+ - all_atoms[basis_list[1]-1].location)
plane_n = basis1.cross(basis2)
-
- dist_n = (all_atoms[atom1-1].location
+
+ dist_n = (all_atoms[atom1-1].location
- all_atoms[atom2-1].location)
dist_n = dist_n.cross(plane_n)
- dist_n = dist_n / dist_n.length
+ dist_n = dist_n / dist_n.length
else:
- dist_n = (all_atoms[atom1-1].location
+ dist_n = (all_atoms[atom1-1].location
- all_atoms[atom2-1].location)
- dist_n = Vector((dist_n[1],-dist_n[0],0))
- dist_n = dist_n / dist_n.length
+ dist_n = Vector((dist_n[1],-dist_n[0],0))
+ dist_n = dist_n / dist_n.length
elif number > 3:
number = 1
dist_n = None
@@ -470,7 +470,7 @@ def read_pdb_file_sticks(filepath_pdb, use_sticks_bonds, all_atoms):
line = line.rstrip()
filepath_pdb_p.close()
-
+
return all_sticks
@@ -495,7 +495,7 @@ def build_stick(radius, length, sectors):
vertices = vertices_top + vertices_bottom
# Side facets (Cylinder)
- faces1 = []
+ faces1 = []
for i in range(sectors-1):
if i == sectors-2:
faces1.append( [i+1, 1, 1+sectors, i+1+sectors] )
@@ -503,7 +503,7 @@ def build_stick(radius, length, sectors):
faces1.append( [i+1, i+2, i+2+sectors, i+1+sectors] )
# Top facets
- faces2 = []
+ faces2 = []
for i in range(sectors-1):
if i == sectors-2:
face_top = [0,sectors-1,1]
@@ -535,9 +535,9 @@ def build_stick(radius, length, sectors):
# Function, which puts a camera and light source into the 3D scene
-def camera_light_source(use_camera,
- use_lamp,
- object_center_vec,
+def camera_light_source(use_camera,
+ use_lamp,
+ object_center_vec,
object_size):
camera_factor = 15.0
@@ -556,7 +556,7 @@ def camera_light_source(use_camera,
camera_xyz_vec = object_center_vec + object_camera_vec
# Create the camera
- current_layers=bpy.context.scene.layers
+ current_layers=bpy.context.scene.layers
camera_data = bpy.data.cameras.new("A_camera")
camera_data.lens = 45
camera_data.clip_end = 500.0
@@ -578,8 +578,8 @@ def camera_light_source(use_camera,
# Rotate the camera around its axis by 90° such that we have a nice
# camera position and view onto the object.
- bpy.ops.object.select_all(action='DESELECT')
- camera.select = True
+ bpy.ops.object.select_all(action='DESELECT')
+ camera.select = True
bpy.ops.transform.rotate(value=(90.0*2*pi/360.0),
axis=object_camera_vec,
constraint_axis=(False, False, False),
@@ -610,11 +610,11 @@ def camera_light_source(use_camera,
lamp_data = bpy.data.lamps.new(name="A_lamp", type="POINT")
lamp_data.distance = 500.0
lamp_data.energy = 3.0
- lamp_data.shadow_method = 'RAY_SHADOW'
+ lamp_data.shadow_method = 'RAY_SHADOW'
lamp = bpy.data.objects.new("A_lamp", lamp_data)
lamp.location = lamp_xyz_vec
lamp.layers = current_layers
- bpy.context.scene.objects.link(lamp)
+ bpy.context.scene.objects.link(lamp)
# Some settings for the World: a bit ambient occlusion
bpy.context.scene.world.light_settings.use_ambient_occlusion = True
@@ -622,9 +622,9 @@ def camera_light_source(use_camera,
# Function, which draws the atoms of one type (balls). This is one
-# dupliverts structure then.
+# dupliverts structure then.
# Return: the dupliverts structure
-def draw_atoms_one_type(draw_all_atoms_type,
+def draw_atoms_one_type(draw_all_atoms_type,
Ball_type,
Ball_azimuth,
Ball_zenith,
@@ -672,8 +672,8 @@ def draw_atoms_one_type(draw_all_atoms_type,
layers=current_layers)
# Meta balls
elif Ball_type == "2":
- bpy.ops.object.metaball_add(type='BALL', view_align=False,
- enter_editmode=False, location=(0, 0, 0),
+ bpy.ops.object.metaball_add(type='BALL', view_align=False,
+ enter_editmode=False, location=(0, 0, 0),
rotation=(0, 0, 0), layers=current_layers)
ball = bpy.context.scene.objects.active
@@ -688,13 +688,13 @@ def draw_atoms_one_type(draw_all_atoms_type,
new_atom_mesh.dupli_type = 'VERTS'
# The object is back translated to 'object_center_vec'.
new_atom_mesh.location = object_center_vec
-
+
return new_atom_mesh
# Function, which draws the sticks with help of the dupliverts technique.
# Return: list of dupliverts structures.
-def draw_sticks_dupliverts(all_atoms,
+def draw_sticks_dupliverts(all_atoms,
atom_all_types_list,
center,
all_sticks,
@@ -706,89 +706,89 @@ def draw_sticks_dupliverts(all_atoms,
use_sticks_color):
dl = Stick_unit
-
- if use_sticks_color == False:
+
+ if use_sticks_color == False:
bpy.ops.object.material_slot_add()
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
- stick_material.diffuse_color = ELEMENTS[-1].color
+ stick_material.diffuse_color = ELEMENTS[-1].color
- # Sort the sticks and put them into a new list such that ...
+ # Sort the sticks and put them into a new list such that ...
sticks_all_lists = []
if use_sticks_color == True:
for atom_type in atom_all_types_list:
if atom_type[0] == "TER":
- continue
+ continue
sticks_list = []
for stick in all_sticks:
-
+
for repeat in range(stick.number):
-
+
atom1 = copy(all_atoms[stick.atom1-1].location)-center
- atom2 = copy(all_atoms[stick.atom2-1].location)-center
-
+ atom2 = copy(all_atoms[stick.atom2-1].location)-center
+
dist = Stick_diameter * Stick_dist
-
- if stick.number == 2:
+
+ if stick.number == 2:
if repeat == 0:
atom1 += (stick.dist * dist)
atom2 += (stick.dist * dist)
if repeat == 1:
- atom1 -= (stick.dist * dist)
- atom2 -= (stick.dist * dist)
+ atom1 -= (stick.dist * dist)
+ atom2 -= (stick.dist * dist)
- if stick.number == 3:
+ if stick.number == 3:
if repeat == 0:
atom1 += (stick.dist * dist)
atom2 += (stick.dist * dist)
if repeat == 2:
- atom1 -= (stick.dist * dist)
- atom2 -= (stick.dist * dist)
+ atom1 -= (stick.dist * dist)
+ atom2 -= (stick.dist * dist)
- dv = atom1 - atom2
+ dv = atom1 - atom2
n = dv / dv.length
if atom_type[0] == all_atoms[stick.atom1-1].name:
location = atom1
name = "_" + all_atoms[stick.atom1-1].name
material = all_atoms[stick.atom1-1].material
sticks_list.append([name, location, dv, material])
- if atom_type[0] == all_atoms[stick.atom2-1].name:
+ if atom_type[0] == all_atoms[stick.atom2-1].name:
location = atom1 - n * dl * int(ceil(dv.length / (2.0 * dl)))
name = "_" + all_atoms[stick.atom2-1].name
material = all_atoms[stick.atom2-1].material
sticks_list.append([name, location, dv, material])
-
- if sticks_list != []:
+
+ if sticks_list != []:
sticks_all_lists.append(sticks_list)
else:
sticks_list = []
for stick in all_sticks:
-
+
if stick.number > 3:
stick.number = 1
-
- for repeat in range(stick.number):
-
+
+ for repeat in range(stick.number):
+
atom1 = copy(all_atoms[stick.atom1-1].location)-center
atom2 = copy(all_atoms[stick.atom2-1].location)-center
-
+
dist = Stick_diameter * Stick_dist
-
- if stick.number == 2:
+
+ if stick.number == 2:
if repeat == 0:
atom1 += (stick.dist * dist)
atom2 += (stick.dist * dist)
if repeat == 1:
- atom1 -= (stick.dist * dist)
- atom2 -= (stick.dist * dist)
- if stick.number == 3:
+ atom1 -= (stick.dist * dist)
+ atom2 -= (stick.dist * dist)
+ if stick.number == 3:
if repeat == 0:
atom1 += (stick.dist * dist)
atom2 += (stick.dist * dist)
if repeat == 2:
- atom1 -= (stick.dist * dist)
- atom2 -= (stick.dist * dist)
-
- dv = atom1 - atom2
+ atom1 -= (stick.dist * dist)
+ atom2 -= (stick.dist * dist)
+
+ dv = atom1 - atom2
n = dv / dv.length
location = atom1
material = stick_material
@@ -802,22 +802,22 @@ def draw_sticks_dupliverts(all_atoms,
vertices = []
faces = []
i = 0
-
+
# What follows is school mathematics! :-)
for stick in stick_list:
-
+
dv = stick[2]
v1 = stick[1]
n = dv / dv.length
gamma = -n * v1
b = v1 + gamma * n
n_b = b / b.length
-
+
if use_sticks_color == True:
loops = int(ceil(dv.length / (2.0 * dl)))
else:
loops = int(ceil(dv.length / dl))
-
+
for j in range(loops):
g = v1 - n * dl / 2.0 - n * dl * j
@@ -846,10 +846,10 @@ def draw_sticks_dupliverts(all_atoms,
stick_cylinder = object_stick[0]
stick_cylinder.active_material = stick[3]
stick_cups = object_stick[1]
- stick_cups.active_material = stick[3]
-
+ stick_cups.active_material = stick[3]
+
# Smooth the cylinders.
- if use_sticks_smooth == True:
+ if use_sticks_smooth == True:
bpy.ops.object.select_all(action='DESELECT')
stick_cylinder.select = True
stick_cups.select = True
@@ -868,17 +868,17 @@ def draw_sticks_dupliverts(all_atoms,
# Function, which draws the sticks with help of the skin and subdivision
# modifiers.
-def draw_sticks_skin(all_atoms,
+def draw_sticks_skin(all_atoms,
all_sticks,
Stick_diameter,
use_sticks_smooth,
sticks_subdiv_view,
sticks_subdiv_render):
- # These counters are for the edges, in the shape [i,i+1].
+ # These counters are for the edges, in the shape [i,i+1].
i = 0
-
- # This is the list of vertices, containing the atom position
+
+ # This is the list of vertices, containing the atom position
# (vectors)).
stick_vertices = []
# This is the 'same' list, which contains not vector position of
@@ -886,34 +886,34 @@ def draw_sticks_skin(all_atoms,
stick_vertices_nr = []
# This is the list of edges.
stick_edges = []
-
+
# Go through the list of all sticks. For each stick do:
for stick in all_sticks:
-
- # Each stick has two atoms = two vertices.
-
+
+ # Each stick has two atoms = two vertices.
+
"""
[ 0,1 , 3,4 , 0,8 , 7,3]
[[0,1], [2,3], [4,5], [6,7]]
-
+
[ 0,1 , 3,4 , x,8 , 7,x] x:deleted
[[0,1], [2,3], [0,5], [6,2]]
"""
-
+
# Check, if the vertex (atom) is already in the vertex list.
# edge: [s1,s2]
- FLAG_s1 = False
+ FLAG_s1 = False
s1 = 0
- for stick2 in stick_vertices_nr:
- if stick2 == stick.atom1-1:
+ for stick2 in stick_vertices_nr:
+ if stick2 == stick.atom1-1:
FLAG_s1 = True
break
s1 += 1
FLAG_s2 = False
s2 = 0
- for stick2 in stick_vertices_nr:
+ for stick2 in stick_vertices_nr:
if stick2 == stick.atom2-1:
- FLAG_s2 = True
+ FLAG_s2 = True
break
s2 += 1
@@ -924,14 +924,14 @@ def draw_sticks_skin(all_atoms,
atom1 = copy(all_atoms[stick.atom1-1].location)
stick_vertices.append(atom1)
stick_vertices_nr.append(stick.atom1-1)
- # For the second atom:
- if FLAG_s2 == False:
+ # For the second atom:
+ if FLAG_s2 == False:
atom2 = copy(all_atoms[stick.atom2-1].location)
stick_vertices.append(atom2)
- stick_vertices_nr.append(stick.atom2-1)
+ stick_vertices_nr.append(stick.atom2-1)
# Build the edges:
-
+
# If both vertices (atoms) were not in the lists, then
# the edge is simply [i,i+1]. These are two new vertices
# (atoms), so increase i by 2.
@@ -940,15 +940,15 @@ def draw_sticks_skin(all_atoms,
i += 2
# Both vertices (atoms) were already in the list, so then
# use the vertices (atoms), which already exist. They are
- # at positions s1 and s2.
+ # at positions s1 and s2.
if FLAG_s1 == True and FLAG_s2 == True:
stick_edges.append([s1,s2])
- # The following two if cases describe the situation that
+ # The following two if cases describe the situation that
# only one vertex (atom) was in the list. Since only ONE
# new vertex was added, increase i by one.
if FLAG_s1 == True and FLAG_s2 == False:
stick_edges.append([s1,i])
- i += 1
+ i += 1
if FLAG_s1 == False and FLAG_s2 == True:
stick_edges.append([i,s2])
i += 1
@@ -959,8 +959,8 @@ def draw_sticks_skin(all_atoms,
stick_mesh.update()
new_stick_mesh = bpy.data.objects.new("Sticks", stick_mesh)
bpy.context.scene.objects.link(new_stick_mesh)
-
- # Apply the skin modifier.
+
+ # Apply the skin modifier.
new_stick_mesh.modifiers.new(name="Sticks_skin", type='SKIN')
# Smooth the skin surface if this option has been chosen.
new_stick_mesh.modifiers[0].use_smooth_shade = use_sticks_smooth
@@ -969,20 +969,20 @@ def draw_sticks_skin(all_atoms,
# Options: choose the levels
new_stick_mesh.modifiers[1].levels = sticks_subdiv_view
new_stick_mesh.modifiers[1].render_levels = sticks_subdiv_render
-
+
bpy.ops.object.material_slot_add()
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
- stick_material.diffuse_color = ELEMENTS[-1].color
+ stick_material.diffuse_color = ELEMENTS[-1].color
new_stick_mesh.active_material = stick_material
-
+
# This is for putting the radiu of the sticks onto
# the desired value 'Stick_diameter'
bpy.context.scene.objects.active = new_stick_mesh
# EDIT mode
- bpy.ops.object.mode_set(mode='EDIT', toggle=False)
+ bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bm = bmesh.from_edit_mesh(new_stick_mesh.data)
bpy.ops.mesh.select_all(action='DESELECT')
-
+
# Select all vertices
for v in bm.verts:
v.select = True
@@ -990,32 +990,32 @@ def draw_sticks_skin(all_atoms,
# This is somewhat a factor for the radius.
r_f = 4.0
# Apply operator 'skin_resize'.
- bpy.ops.transform.skin_resize(value=(Stick_diameter*r_f,
- Stick_diameter*r_f,
- Stick_diameter*r_f),
- constraint_axis=(False, False, False),
- constraint_orientation='GLOBAL',
- mirror=False,
- proportional='DISABLED',
- proportional_edit_falloff='SMOOTH',
- proportional_size=1,
- snap=False,
- snap_target='CLOSEST',
- snap_point=(0, 0, 0),
- snap_align=False,
- snap_normal=(0, 0, 0),
- texture_space=False,
+ bpy.ops.transform.skin_resize(value=(Stick_diameter*r_f,
+ Stick_diameter*r_f,
+ Stick_diameter*r_f),
+ constraint_axis=(False, False, False),
+ constraint_orientation='GLOBAL',
+ mirror=False,
+ proportional='DISABLED',
+ proportional_edit_falloff='SMOOTH',
+ proportional_size=1,
+ snap=False,
+ snap_target='CLOSEST',
+ snap_point=(0, 0, 0),
+ snap_align=False,
+ snap_normal=(0, 0, 0),
+ texture_space=False,
release_confirm=False)
# Back to the OBJECT mode.
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
+
return new_stick_mesh
# Draw the sticks the normal way: connect the atoms by simple cylinders.
# Two options: 1. single cylinders parented to an empty
# 2. one single mesh object
-def draw_sticks_normal(all_atoms,
+def draw_sticks_normal(all_atoms,
all_sticks,
center,
Stick_diameter,
@@ -1023,11 +1023,11 @@ def draw_sticks_normal(all_atoms,
use_sticks_smooth,
use_sticks_one_object,
use_sticks_one_object_nr):
-
+
bpy.ops.object.material_slot_add()
stick_material = bpy.data.materials.new(ELEMENTS[-1].name)
stick_material.diffuse_color = ELEMENTS[-1].color
-
+
up_axis = Vector([0.0, 0.0, 1.0])
current_layers = bpy.context.scene.layers
@@ -1046,20 +1046,20 @@ def draw_sticks_normal(all_atoms,
v = (atom2 - atom1)
# Angle with respect to the z-axis
angle = v.angle(up_axis, 0)
- # Cross-product between v and the z-axis vector. It is the
+ # Cross-product between v and the z-axis vector. It is the
# vector of rotation.
axis = up_axis.cross(v)
# Calculate Euler angles
euler = Matrix.Rotation(angle, 4, axis).to_euler()
# Create stick
- bpy.ops.mesh.primitive_cylinder_add(vertices=Stick_sectors,
- radius=Stick_diameter,
- depth=v.length,
- end_fill_type='NGON',
- view_align=False,
- enter_editmode=False,
- location=location,
- rotation=(0, 0, 0),
+ bpy.ops.mesh.primitive_cylinder_add(vertices=Stick_sectors,
+ radius=Stick_diameter,
+ depth=v.length,
+ end_fill_type='NGON',
+ view_align=False,
+ enter_editmode=False,
+ location=location,
+ rotation=(0, 0, 0),
layers=current_layers)
# Put the stick into the scene ...
stick = bpy.context.scene.objects.active
@@ -1068,15 +1068,15 @@ def draw_sticks_normal(all_atoms,
# ... and name
stick.name = "Stick_Cylinder"
counter += 1
-
+
# Smooth the cylinder.
- if use_sticks_smooth == True:
+ if use_sticks_smooth == True:
bpy.ops.object.select_all(action='DESELECT')
stick.select = True
- bpy.ops.object.shade_smooth()
-
+ bpy.ops.object.shade_smooth()
+
list_group_sub.append(stick)
-
+
if use_sticks_one_object == True:
if counter == use_sticks_one_object_nr:
bpy.ops.object.select_all(action='DESELECT')
@@ -1088,8 +1088,8 @@ def draw_sticks_normal(all_atoms,
list_group_sub = []
counter = 0
else:
- # Material ...
- stick.active_material = stick_material
+ # Material ...
+ stick.active_material = stick_material
if use_sticks_one_object == True:
bpy.ops.object.select_all(action='DESELECT')
@@ -1101,21 +1101,21 @@ def draw_sticks_normal(all_atoms,
for group in list_group:
group.select = True
- bpy.ops.object.join()
- bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY',
+ bpy.ops.object.join()
+ bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY',
center='MEDIAN')
sticks = bpy.context.scene.objects.active
sticks.active_material = stick_material
else:
- bpy.ops.object.empty_add(type='ARROWS',
- view_align=False,
- location=(0, 0, 0),
- rotation=(0, 0, 0),
+ bpy.ops.object.empty_add(type='ARROWS',
+ view_align=False,
+ location=(0, 0, 0),
+ rotation=(0, 0, 0),
layers=current_layers)
sticks = bpy.context.scene.objects.active
for stick in list_group_sub:
stick.parent = sticks
-
+
sticks.name = "Sticks"
sticks.location += center
@@ -1224,8 +1224,8 @@ def import_pdb(Ball_type,
# ------------------------------------------------------------------------
# READING DATA OF STICKS
- all_sticks = read_pdb_file_sticks(filepath_pdb,
- use_sticks_bonds,
+ all_sticks = read_pdb_file_sticks(filepath_pdb,
+ use_sticks_bonds,
all_atoms)
#
@@ -1318,7 +1318,7 @@ def import_pdb(Ball_type,
# For each list of atoms of ONE type (e.g. Hydrogen)
for draw_all_atoms_type in draw_all_atoms:
- atom_mesh = draw_atoms_one_type(draw_all_atoms_type,
+ atom_mesh = draw_atoms_one_type(draw_all_atoms_type,
Ball_type,
Ball_azimuth,
Ball_zenith,
@@ -1327,11 +1327,11 @@ def import_pdb(Ball_type,
atom_object_list.append(atom_mesh)
# ------------------------------------------------------------------------
- # DRAWING THE STICKS: cylinders in a dupliverts structure
+ # DRAWING THE STICKS: cylinders in a dupliverts structure
if use_sticks == True and use_sticks_type == '0' and all_sticks != []:
-
- sticks = draw_sticks_dupliverts(all_atoms,
+
+ sticks = draw_sticks_dupliverts(all_atoms,
atom_all_types_list,
object_center_vec,
all_sticks,
@@ -1341,15 +1341,15 @@ def import_pdb(Ball_type,
Stick_dist,
use_sticks_smooth,
use_sticks_color)
- for stick in sticks:
+ for stick in sticks:
atom_object_list.append(stick)
# ------------------------------------------------------------------------
# DRAWING THE STICKS: skin and subdivision modifier
-
+
if use_sticks == True and use_sticks_type == '1' and all_sticks != []:
- sticks = draw_sticks_skin(all_atoms,
+ sticks = draw_sticks_skin(all_atoms,
all_sticks,
Stick_diameter,
use_sticks_smooth,
@@ -1359,10 +1359,10 @@ def import_pdb(Ball_type,
# ------------------------------------------------------------------------
# DRAWING THE STICKS: normal cylinders
-
+
if use_sticks == True and use_sticks_type == '2' and all_sticks != []:
-
- sticks = draw_sticks_normal(all_atoms,
+
+ sticks = draw_sticks_normal(all_atoms,
all_sticks,
object_center_vec,
Stick_diameter,
@@ -1375,9 +1375,9 @@ def import_pdb(Ball_type,
# ------------------------------------------------------------------------
# CAMERA and LIGHT SOURCES
- camera_light_source(use_camera,
- use_lamp,
- object_center_vec,
+ camera_light_source(use_camera,
+ use_lamp,
+ object_center_vec,
object_size)
# ------------------------------------------------------------------------
diff --git a/io_mesh_stl/stl_utils.py b/io_mesh_stl/stl_utils.py
index a5edbee7..e2aabee4 100644
--- a/io_mesh_stl/stl_utils.py
+++ b/io_mesh_stl/stl_utils.py
@@ -182,7 +182,7 @@ def _binary_write(filepath, faces):
# write normal + vertexes + pad as attributes
fw(struct.pack('<3f', *normal(*face)) + pack(*itertools.chain.from_iterable(face)))
# attribute byte count (unused)
- fw(b'\0\0')
+ fw(b'\0\0')
nb += 1
# header, with correct value now
diff --git a/io_scene_fbx/export_fbx.py b/io_scene_fbx/export_fbx.py
index ff39ff44..dc647f71 100644
--- a/io_scene_fbx/export_fbx.py
+++ b/io_scene_fbx/export_fbx.py
@@ -1571,7 +1571,7 @@ def save_single(operator, scene, filepath="",
if do_textures:
fw('\n\t\tLayerElementTexture: %d {'
'\n\t\t\tVersion: 101'
- '\n\t\t\tName: "%s"'
+ '\n\t\t\tName: "%s"'
'\n\t\t\tMappingInformationType: "%s"'
'\n\t\t\tReferenceInformationType: "IndexToDirect"'
'\n\t\t\tBlendMode: "Translucent"'
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 87e1973f..caf65efd 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -290,7 +290,7 @@ from collections import namedtuple
FBXTransformData = namedtuple("FBXTransformData", (
- "loc", "geom_loc",
+ "loc", "geom_loc",
"rot", "rot_ofs", "rot_piv", "pre_rot", "pst_rot", "rot_ord", "rot_alt_mat", "geom_rot",
"sca", "sca_ofs", "sca_piv", "geom_sca",
))
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index a94080c7..89613368 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -388,7 +388,7 @@ def write_file(filepath, objects, scene,
# END NURBS
try:
- me = ob.to_mesh(scene, EXPORT_APPLY_MODIFIERS, calc_tessface=False,
+ me = ob.to_mesh(scene, EXPORT_APPLY_MODIFIERS, calc_tessface=False,
settings='RENDER' if EXPORT_APPLY_MODIFIERS_RENDER else 'PREVIEW')
except RuntimeError:
me = None
diff --git a/light_field_tools/light_field_tools.py b/light_field_tools/light_field_tools.py
index f690add5..fcc967be 100644
--- a/light_field_tools/light_field_tools.py
+++ b/light_field_tools/light_field_tools.py
@@ -32,14 +32,14 @@ also supports the projection of lightfields with textured
spotlights.
Usage:
-A simple interface can be accessed in the tool shelf panel
+A simple interface can be accessed in the tool shelf panel
in 3D View ([T] Key).
A base mesh has to be provided, which will normaly be a
subdivided plane. The script will then create a camera rig
and a light rig with adjustable properties. A sample camera
and a spotlight will be created on each vertex of the
-basemesh object axis (maybe vertex normal in future
+basemesh object axis (maybe vertex normal in future
versions).
Vertex order:
@@ -55,7 +55,7 @@ versions).
x->
There is also a tool to create a basemesh, which is an
-evenly spaced grid. The row length parameter is taken to
+evenly spaced grid. The row length parameter is taken to
construct such a NxN grid. Someone would start out by adding
a rectengular plane as the slice plane of the frustrum of
the most middle camera of the light field rig. The spacing
@@ -159,9 +159,9 @@ class OBJECT_OT_create_lightfield_rig(bpy.types.Operator):
cam.location = vert[0]
# rotation
cam.rotation_euler = self.baseObject.rotation_euler
- # insert LocRot keyframes
+ # insert LocRot keyframes
cam.keyframe_insert('location')
-
+
# set anim render props
scene.frame_current = 0
scene.frame_start = 0
@@ -242,7 +242,7 @@ class OBJECT_OT_create_lightfield_rig(bpy.types.Operator):
# FIXME
spot.data.distance = 10
- # set spot props
+ # set spot props
spot.data.energy = scene.lightfield.light_intensity / self.numSamples
spot.data.spot_size = scene.lightfield.angle
spot.data.spot_blend = scene.lightfield.spot_blend
@@ -279,7 +279,7 @@ class OBJECT_OT_create_lightfield_rig(bpy.types.Operator):
self.numSamples = len(self.verts)
if scene.lightfield.create_handler:
- #create an empty
+ #create an empty
bpy.ops.object.add(type='EMPTY')
empty = bpy.context.active_object
empty.location = self.baseObject.location
@@ -296,16 +296,16 @@ class OBJECT_OT_create_lightfield_rig(bpy.types.Operator):
self.createLightfieldEmitter(textured=False)
return {'FINISHED'}
-
-class OBJECT_OT_create_lightfield_basemesh(bpy.types.Operator):
+
+class OBJECT_OT_create_lightfield_basemesh(bpy.types.Operator):
"""Creates a basemsh from the selected focal plane"""
bl_idname="object.create_lightfield_basemesh"
bl_label="Create a basemesh from the selected focal plane"
bl_options = {'REGISTER'}
-
+
objName = "lf_basemesh"
@@ -327,15 +327,15 @@ class OBJECT_OT_create_lightfield_basemesh(bpy.types.Operator):
def addMeshObj(self, mesh):
scene = bpy.context.scene
-
+
for o in scene.objects:
- o.select = False
-
+ o.select = False
+
mesh.update()
nobj = bpy.data.objects.new(self.objName, mesh)
scene.objects.link(nobj)
- nobj.select = True
-
+ nobj.select = True
+
if scene.objects.active is None or scene.objects.active.mode == 'OBJECT':
scene.objects.active = nobj
@@ -390,7 +390,7 @@ class OBJECT_OT_create_lightfield_basemesh(bpy.types.Operator):
self.addMeshObj(mesh)
return {'FINISHED'}
-
+
@@ -403,7 +403,7 @@ class VIEW3D_OT_lightfield_tools(bpy.types.Panel):
def draw(self, context):
layout = self.layout
-
+
scene = context.scene
col = layout.column()
@@ -411,7 +411,7 @@ class VIEW3D_OT_lightfield_tools(bpy.types.Panel):
col.prop(scene.lightfield, "angle")
col.prop(scene.lightfield, "create_handler")
-
+
col.prop(scene.lightfield, "do_camera")
col.prop(scene.lightfield, "animate_camera")
col.prop(scene.lightfield, "do_projection")
diff --git a/mesh_f2.py b/mesh_f2.py
index 4f85f3a0..44d27a8c 100644
--- a/mesh_f2.py
+++ b/mesh_f2.py
@@ -289,7 +289,7 @@ def quad_from_vertex(bm, vert_sel, context, event):
uv_others[loop.vert.index] = loop[uv_layer].uv
break
if len(uv_others) == 2:
- mid_other = (list(uv_others.values())[0] +
+ mid_other = (list(uv_others.values())[0] +
list(uv_others.values())[1]) / 2
for loop in vert_sel.link_loops:
if loop.face.index > -1:
@@ -397,7 +397,7 @@ def unregister():
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
-
+
# remove operator and preferences
for c in reversed(classes):
bpy.utils.unregister_class(c)
diff --git a/mesh_looptools.py b/mesh_looptools.py
index 36e4a5c2..b05c7830 100644
--- a/mesh_looptools.py
+++ b/mesh_looptools.py
@@ -3717,15 +3717,15 @@ class RemoveGP(bpy.types.Operator):
bl_label = "Remove GP"
bl_description = "Remove all Grease Pencil Strokes"
bl_options = {'REGISTER', 'UNDO'}
-
+
def execute(self, context):
-
+
if context.gpencil_data is not None:
bpy.ops.gpencil.data_unlink()
else:
self.report({'INFO'}, "No Grease Pencil data to Unlink")
return {'CANCELLED'}
-
+
return{'FINISHED'}
class GStretch(bpy.types.Operator):
diff --git a/netrender/baking.py b/netrender/baking.py
index f3a759a4..f595a26b 100644
--- a/netrender/baking.py
+++ b/netrender/baking.py
@@ -26,14 +26,14 @@ def commandToTask(command):
i = command.index("|")
ri = command.rindex("|")
return (command[:i], command[i+1:ri], command[ri+1:])
-
+
def taskToCommand(task):
return "|".join(task)
-
+
def bake(job, tasks):
main_file = job.files[0]
job_full_path = main_file.filepath
-
+
task_commands = []
for task in tasks:
task_commands.extend(task)
@@ -61,34 +61,34 @@ def resultsFromOuput(lines):
if match:
task_id = int(match.groups()[0])
task_filename = match.groups()[1]
-
+
results.append((task_id, task_filename))
-
+
return results
def bake_cache(obj, point_cache, task_index):
if point_cache.is_baked:
bpy.ops.ptcache.free_bake({"point_cache": point_cache})
-
+
point_cache.use_disk_cache = True
point_cache.use_external = False
-
+
bpy.ops.ptcache.bake({"point_cache": point_cache}, bake=True)
-
+
results = cache_results(obj, point_cache)
-
+
print()
-
+
for filename in results:
print("BAKE FILE[", task_index, "]:", filename)
-
+
def cache_results(obj, point_cache):
name = cacheName(obj, point_cache)
default_path = cachePath(bpy.data.filepath)
cache_path = bpy.path.abspath(point_cache.filepath) if point_cache.use_external else default_path
-
+
index = "%02i" % point_cache.index
if os.path.exists(cache_path):
@@ -103,9 +103,9 @@ def cache_results(obj, point_cache):
cache_files.append(os.path.join(cache_path, cache_file))
cache_files.sort()
-
+
return cache_files
-
+
return []
def process_generic(obj, index, task_index):
@@ -143,12 +143,12 @@ if __name__ == "__main__":
i = sys.argv.index("--")
except:
i = 0
-
+
if i:
task_args = sys.argv[i+1:]
for i in range(0, len(task_args), 3):
bake_type = task_args[i]
obj = bpy.data.objects[task_args[i+1]]
index = int(task_args[i+2])
-
+
process_funcs.get(bake_type, process_null)(obj, index, i)
diff --git a/netrender/balancing.py b/netrender/balancing.py
index b6531604..e60165dd 100644
--- a/netrender/balancing.py
+++ b/netrender/balancing.py
@@ -174,7 +174,7 @@ class NewJobPriority(PriorityRule):
"enabled": self.enabled,
"editable": self.editable,
"descritpiton":str(self),
- "limit": self.limit,
+ "limit": self.limit,
"limit_str":self.str_limit(),
"id":self.id()
}
@@ -215,7 +215,7 @@ class ExcludeQueuedEmptyJob(ExclusionRule):
def test(self, job):
return job.status != netrender.model.JOB_QUEUED or job.countFrames(status = netrender.model.FRAME_QUEUED) == 0
-
+
def serialize(self):
return { "type": "exception",
"enabled": self.enabled,
diff --git a/netrender/client.py b/netrender/client.py
index 0ad9a1e4..8c5499b6 100644
--- a/netrender/client.py
+++ b/netrender/client.py
@@ -104,10 +104,10 @@ def fillCommonJobSettings(job, job_name, netsettings):
job.render = netsettings.job_render_engine_other
else:
job.render = netsettings.job_render_engine
-
+
if netsettings.job_tags:
job.tags.update(netsettings.job_tags.split(";"))
-
+
if netsettings.job_type == "JOB_BLENDER":
job.type = netrender.model.JOB_BLENDER
elif netsettings.job_type == "JOB_PROCESS":
@@ -133,16 +133,16 @@ def sendJobVCS(conn, scene, anim = False):
job.addFrame(scene.frame_current)
filename = bpy.data.filepath
-
+
if not filename.startswith(netsettings.vcs_wpath):
# this is an error, need better way to handle this
return
filename = filename[len(netsettings.vcs_wpath):]
-
+
if filename[0] in {os.sep, os.altsep}:
filename = filename[1:]
-
+
job.addFile(filename, signed=False)
job_name = netsettings.job_name
@@ -152,14 +152,14 @@ def sendJobVCS(conn, scene, anim = False):
fillCommonJobSettings(job, job_name, netsettings)
-
+
# VCS Specific code
job.version_info = netrender.model.VersioningInfo()
job.version_info.system = netsettings.vcs_system
job.version_info.wpath = netsettings.vcs_wpath
job.version_info.rpath = netsettings.vcs_rpath
job.version_info.revision = netsettings.vcs_revision
-
+
job.tags.add(netrender.model.TAG_RENDER)
# try to send path first
@@ -169,7 +169,7 @@ def sendJobVCS(conn, scene, anim = False):
response.read()
job_id = response.getheader("job-id")
-
+
# a VCS job is always good right now, need error handling
return job_id
@@ -179,20 +179,20 @@ def sendJobBaking(conn, scene, can_save = True):
job = netrender.model.RenderJob()
filename = bpy.data.filepath
-
+
if not os.path.exists(filename):
raise RuntimeError("Current file path not defined\nSave your file before sending a job")
if can_save and netsettings.save_before_job:
bpy.ops.wm.save_mainfile(filepath=filename, check_existing=False)
-
+
job.addFile(filename)
job_name = netsettings.job_name
path, name = os.path.split(filename)
if job_name == "[default]":
job_name = name
-
+
###############################
# LIBRARIES (needed for baking)
###############################
@@ -202,7 +202,7 @@ def sendJobBaking(conn, scene, can_save = True):
job.addFile(file_path)
tasks = set()
-
+
####################################
# FLUID + POINT CACHE (what we bake)
####################################
@@ -213,17 +213,17 @@ def sendJobBaking(conn, scene, can_save = True):
else: # owner is modifier
index = [index for index, data in enumerate(object.modifiers) if data == owner][0]
tasks.add((owner.type, object.name, str(index)))
-
+
def fluidFunc(object, modifier, cache_path):
pass
-
+
def multiresFunc(object, modifier, cache_path):
pass
-
+
processObjectDependencies(pointCacheFunc, fluidFunc, multiresFunc)
fillCommonJobSettings(job, job_name, netsettings)
-
+
job.tags.add(netrender.model.TAG_BAKING)
job.subtype = netrender.model.JOB_SUB_BAKING
job.chunks = 1 # No chunking for baking
@@ -231,7 +231,7 @@ def sendJobBaking(conn, scene, can_save = True):
for i, task in enumerate(tasks):
job.addFrame(i + 1)
job.frames[-1].command = netrender.baking.taskToCommand(task)
-
+
# try to send path first
with ConnectionContext():
conn.request("POST", "/job", json.dumps(job.serialize()))
@@ -253,7 +253,7 @@ def sendJobBaking(conn, scene, can_save = True):
# server will reply with ACCEPTED until all files are found
return job_id
-
+
def sendJobBlender(conn, scene, anim = False, can_save = True):
netsettings = scene.network_render
job = netrender.model.RenderJob()
@@ -268,7 +268,7 @@ def sendJobBlender(conn, scene, anim = False, can_save = True):
if not os.path.exists(filename):
raise RuntimeError("Current file path not defined\nSave your file before sending a job")
-
+
if can_save and netsettings.save_before_job:
bpy.ops.wm.save_mainfile(filepath=filename, check_existing=False)
@@ -295,7 +295,7 @@ def sendJobBlender(conn, scene, anim = False, can_save = True):
file_path = bpy.path.abspath(image.filepath)
if os.path.exists(file_path):
job.addFile(file_path)
-
+
tex_path = os.path.splitext(file_path)[0] + ".tex"
if os.path.exists(tex_path):
job.addFile(tex_path)
@@ -304,22 +304,22 @@ def sendJobBlender(conn, scene, anim = False, can_save = True):
# FLUID + POINT CACHE
###########################
default_path = cachePath(filename)
-
+
def pointCacheFunc(object, owner, point_cache):
addPointCache(job, object, point_cache, default_path)
-
+
def fluidFunc(object, modifier, cache_path):
addFluidFiles(job, cache_path)
-
+
def multiresFunc(object, modifier, cache_path):
job.addFile(cache_path)
-
+
processObjectDependencies(pointCacheFunc, fluidFunc, multiresFunc)
#print(job.files)
fillCommonJobSettings(job, job_name, netsettings)
-
+
job.tags.add(netrender.model.TAG_RENDER)
# try to send path first
@@ -371,7 +371,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
address = "" if netsettings.server_address == "[default]" else netsettings.server_address
- master.runMaster(address = (address, netsettings.server_port),
+ master.runMaster(address = (address, netsettings.server_port),
broadcast = netsettings.use_master_broadcast,
clear = netsettings.use_master_clear,
force = netsettings.use_master_force_upload,
@@ -405,8 +405,8 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
# reading back result
self.update_stats("", "Network render waiting for results")
-
-
+
+
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
buf = response.read()
@@ -419,7 +419,7 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
requestResult(conn, job_id, scene.frame_current)
response = conn.getresponse()
buf = response.read()
-
+
while response.status == http.client.ACCEPTED and not self.test_break():
time.sleep(1)
requestResult(conn, job_id, scene.frame_current)
@@ -442,9 +442,9 @@ class NetworkRenderEngine(bpy.types.RenderEngine):
r = scene.render
x= int(r.resolution_x*r.resolution_percentage*0.01)
y= int(r.resolution_y*r.resolution_percentage*0.01)
-
+
result_path = os.path.join(bpy.path.abspath(netsettings.path), "output.exr")
-
+
folder = os.path.split(result_path)[0]
verifyCreateDir(folder)
diff --git a/netrender/master.py b/netrender/master.py
index 9b7b72a9..456e436d 100644
--- a/netrender/master.py
+++ b/netrender/master.py
@@ -38,20 +38,20 @@ class MRenderFile(netrender.model.RenderFile):
def updateStatus(self):
self.found = os.path.exists(self.filepath)
-
+
if self.found and self.signature != None:
found_signature = hashFile(self.filepath)
self.found = self.signature == found_signature
if not self.found:
print("Signature mismatch", self.signature, found_signature)
-
+
return self.found
def test(self):
# don't check when forcing upload and only until found
if not self.force and not self.found:
self.updateStatus()
-
+
return self.found
@@ -60,7 +60,7 @@ class MRenderSlave(netrender.model.RenderSlave):
super().__init__(slave_info)
self.id = hashlib.md5(bytes(repr(slave_info.name) + repr(slave_info.address), encoding='utf8')).hexdigest()
self.last_seen = time.time()
-
+
self.job = None
self.job_frames = []
@@ -97,7 +97,7 @@ class MRenderJob(netrender.model.RenderJob):
self.last_update = 0
self.save_path = ""
self.files = [MRenderFile(rfile.filepath, rfile.index, rfile.start, rfile.end, rfile.signature) for rfile in job_info.files]
-
+
def setForceUpload(self, force):
for rfile in self.files:
rfile.force = force
@@ -154,7 +154,7 @@ class MRenderJob(netrender.model.RenderJob):
def start(self):
self.status = netrender.model.JOB_QUEUED
-
+
def addLog(self, frames):
frames = sorted(frames)
@@ -174,7 +174,7 @@ class MRenderJob(netrender.model.RenderJob):
def reset(self, all):
for f in self.frames:
f.reset(all)
-
+
if all:
self.status = netrender.model.JOB_QUEUED
@@ -188,7 +188,7 @@ class MRenderJob(netrender.model.RenderJob):
break
return frames
-
+
def getResultPath(self, filename):
return os.path.join(self.save_path, filename)
@@ -239,7 +239,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
f.write(buf)
f.close()
del buf
-
+
def log_message(self, format, *args):
# override because the original calls self.address_string(), which
# is extremely slow due to some timeout..
@@ -256,7 +256,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
def send_head(self, code = http.client.OK, headers = {}, content = "application/octet-stream"):
self.send_response(code)
-
+
if code == http.client.OK and content:
self.send_header("Content-type", content)
@@ -351,10 +351,10 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if frame.status == netrender.model.FRAME_DONE:
for filename in frame.results:
filepath = job.getResultPath(filename)
-
+
zfile.write(filepath, filename)
-
-
+
+
f = open(zip_filepath, 'rb')
self.send_head(content = "application/x-zip-compressed")
shutil.copyfileobj(f, self.wfile)
@@ -577,7 +577,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
job_id = self.server.nextJobID()
job = MRenderJob(job_id, job_info)
-
+
job.setForceUpload(self.server.force)
for frame in job_info.frames:
@@ -728,7 +728,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
self.server.stats("", "New slave connected")
slave_info = netrender.model.RenderSlave.materialize(json.loads(str(self.rfile.read(length), encoding='utf8')), cache = False)
-
+
slave_info.address = self.client_address
slave_id = self.server.addSlave(slave_info)
@@ -790,12 +790,12 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
file_path = os.path.join(job.save_path, main_name)
# add same temp file + renames as slave
-
+
self.write_file(file_path)
-
+
rfile.filepath = file_path # set the new path
found = rfile.updateStatus() # make sure we have the right file
-
+
if not found: # checksum mismatch
self.server.stats("", "File upload but checksum mismatch, this shouldn't happen")
self.send_head(http.client.CONFLICT)
@@ -882,19 +882,19 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if frame:
job_result = int(self.headers['job-result'])
job_finished = self.headers['job-finished'] == str(True)
-
+
self.send_head(content = None)
if job_result == netrender.model.FRAME_DONE:
result_filename = self.headers['result-filename']
-
+
frame.results.append(result_filename)
self.write_file(job.getResultPath(result_filename))
-
+
if job_finished:
job_time = float(self.headers['job-time'])
slave.finishedFrame(job_frame)
-
+
frame.status = job_result
frame.time = job_time
@@ -925,7 +925,7 @@ class RenderHandler(http.server.BaseHTTPRequestHandler):
if frame:
self.send_head(content = None)
-
+
if job.hasRenderResult():
self.write_file(os.path.join(os.path.join(job.save_path, "%06d.jpg" % job_frame)))
@@ -996,7 +996,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
def restore(self, jobs, slaves, balancer = None):
self.jobs = jobs
self.jobs_map = {}
-
+
for job in self.jobs:
self.jobs_map[job.id] = job
self.job_id = max(self.job_id, int(job.id))
@@ -1004,10 +1004,10 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
self.slaves = slaves
for slave in self.slaves:
self.slaves_map[slave.id] = slave
-
+
if balancer:
self.balancer = balancer
-
+
def nextJobID(self):
self.job_id += 1
@@ -1123,7 +1123,7 @@ class RenderMasterServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
and slave.id not in job.blacklist # slave is not blacklisted
and (not slave.tags or job.tags.issubset(slave.tags)) # slave doesn't use tags or slave has all job tags
):
-
+
return job, job.getFrames()
return None, None
@@ -1138,17 +1138,17 @@ def createMaster(address, clear, force, path):
print("loading saved master:", filepath)
with open(filepath, 'rb') as f:
path, jobs, slaves = pickle.load(f)
-
+
httpd = RenderMasterServer(address, RenderHandler, path, force=force, subdir=False)
httpd.restore(jobs, slaves)
-
+
return httpd
return RenderMasterServer(address, RenderHandler, path, force=force)
def saveMaster(path, httpd):
filepath = os.path.join(path, "blender_master.data")
-
+
with open(filepath, 'wb') as f:
pickle.dump((httpd.path, httpd.jobs, httpd.slaves), f, pickle.HIGHEST_PROTOCOL)
diff --git a/netrender/master_html.py b/netrender/master_html.py
index e358c7e2..128004d2 100644
--- a/netrender/master_html.py
+++ b/netrender/master_html.py
@@ -46,8 +46,8 @@ def countFiles(job):
elif not file == job.files[0]:
tot_other += 1
return tot_cache,tot_fluid,tot_other;
-
-
+
+
def get(handler):
def output(text):
handler.wfile.write(bytes(text, encoding='utf8'))
@@ -112,11 +112,11 @@ def get(handler):
def checkbox(title, value, script=""):
return """<input type="checkbox" title="%s" %s %s>""" % (title, "checked" if value else "", ("onclick=\"%s\"" % script) if script else "")
-
+
def sendjson(message):
- handler.send_head(content = "application/json")
+ handler.send_head(content = "application/json")
output(json.dumps(message,sort_keys=False))
-
+
def sendFile(filename,content_type):
f = open(os.path.join(src_folder,filename), 'rb')
@@ -126,9 +126,9 @@ def get(handler):
f.close()
# return serialized version of job for html interface
# job: the base job
- # includeFiles: boolean to indicate if we want file to be serialized too into job
- # includeFrames; boolean to indicate if we want frame to be serialized too into job
- def gethtmlJobInfo(job,includeFiles=True,includeFrames=True):
+ # includeFiles: boolean to indicate if we want file to be serialized too into job
+ # includeFrames; boolean to indicate if we want frame to be serialized too into job
+ def gethtmlJobInfo(job,includeFiles=True,includeFrames=True):
if (job):
results = job.framesStatus()
serializedJob = job.serialize(withFiles=includeFiles, withFrames=includeFrames)
@@ -142,27 +142,27 @@ def get(handler):
tot_cache, tot_fluid, tot_other = countFiles(job)
serializedJob["totcache"] = tot_cache
serializedJob["totfluid"] = tot_fluid
- serializedJob["totother"] = tot_other
- serializedJob["wktime"] = (time.time()-job.start_time ) if job.status != netrender.model.JOB_FINISHED else (job.finish_time-job.start_time)
+ serializedJob["totother"] = tot_other
+ serializedJob["wktime"] = (time.time()-job.start_time ) if job.status != netrender.model.JOB_FINISHED else (job.finish_time-job.start_time)
else:
serializedJob={"name":"invalid job"}
-
+
return serializedJob;
-
+
# return serialized files based on cumulative file_type
# job_id: id of the job
# message: serialized content
# file_type: any combinaison of CACHE_FILE,FLUID_FILES, OTHER_FILES
-
+
def getFiles(job_id,message,file_type):
-
+
job=handler.server.getJobID(job_id)
print ("job.files.length="+str(len(job.files)))
-
+
for file in job.files:
filedata=file.serialize()
filedata["name"] = os.path.split(file.filepath)[1]
-
+
if file.filepath.endswith(".bphys") and (file_type & CACHE_FILES):
message.append(filedata);
continue
@@ -172,104 +172,104 @@ def get(handler):
if (not file == job.files[0]) and (file_type & OTHER_FILES) and (not file.filepath.endswith((".bobj.gz", ".bvel.gz"))) and not file.filepath.endswith(".bphys"):
message.append(filedata);
continue
-
-
-
+
+
+
if handler.path == "/html/netrender.js":
sendFile("netrender.js","text/javascript")
-
+
elif handler.path == "/html/netrender.css":
sendFile("netrender.css","text/css")
-
+
elif handler.path =="/html/newui":
sendFile("newui.html","text/html")
-
+
elif handler.path.startswith("/html/js"):
path, filename = os.path.split(handler.path)
sendFile("js/"+filename,"text/javascript")
-
- elif handler.path.startswith("/html/css/images"):
+
+ elif handler.path.startswith("/html/css/images"):
path, filename = os.path.split(handler.path)
sendFile("css/images/"+filename,"image/png")
-
+
elif handler.path.startswith("/html/css"):
path, filename = os.path.split(handler.path)
sendFile("css/"+filename,"text/css")
- # return all master rules information
+ # return all master rules information
elif handler.path == "/html/rules":
message = []
for rule in handler.server.balancer.rules:
message.append(rule.serialize())
for rule in handler.server.balancer.priorities:
- message.append(rule.serialize())
+ message.append(rule.serialize())
for rule in handler.server.balancer.exceptions:
message.append(rule.serialize())
sendjson(message)
- #return all slaves list
+ #return all slaves list
elif handler.path == "/html/slaves":
message = []
for slave in handler.server.slaves:
serializedSlave = slave.serialize()
if slave.job:
serializedSlave["job_name"] = slave.job.name
- serializedSlave["job_id"] = slave.job.id
+ serializedSlave["job_id"] = slave.job.id
else:
serializedSlave["job_name"] = "None"
serializedSlave["job_id"] = "0"
message.append(serializedSlave)
sendjson(message)
- # return all job list
+ # return all job list
elif handler.path == "/html/jobs":
message = []
for job in handler.server.jobs:
if job:
message.append(gethtmlJobInfo(job, False, False))
sendjson(message)
- #return a job information
+ #return a job information
elif handler.path.startswith("/html/job_"):
-
+
job_id = handler.path[10:]
job = handler.server.getJobID(job_id)
-
+
message = []
if job:
-
+
message.append(gethtmlJobInfo(job, includeFiles=False))
sendjson(message)
- # return all frames for a job
+ # return all frames for a job
elif handler.path.startswith("/html/frames_"):
-
+
job_id = handler.path[13:]
job = handler.server.getJobID(job_id)
-
+
message = []
if job:
for f in job.frames:
message.append(f.serialize())
-
+
sendjson(message)
- # return physic cache files
+ # return physic cache files
elif handler.path.startswith("/html/cachefiles_"):
job_id = handler.path[17:]
message = []
getFiles(job_id, message, CACHE_FILES);
- sendjson(message)
- #return fluid cache files
+ sendjson(message)
+ #return fluid cache files
elif handler.path.startswith("/html/fluidfiles_"):
job_id = handler.path[17:]
-
+
message = []
getFiles(job_id, message, FLUID_FILES);
- sendjson(message)
-
- #return list of other files ( images, sequences ...)
+ sendjson(message)
+
+ #return list of other files ( images, sequences ...)
elif handler.path.startswith("/html/otherfiles_"):
job_id = handler.path[17:]
-
+
message = []
getFiles(job_id, message, OTHER_FILES);
- sendjson(message)
- # return blend file info
+ sendjson(message)
+ # return blend file info
elif handler.path.startswith("/html/blendfile_"):
job_id = handler.path[16:]
job = handler.server.getJobID(job_id)
@@ -280,10 +280,10 @@ def get(handler):
sendjson(message)
# return black listed slaves for a job
elif handler.path.startswith("/html/blacklist_"):
-
+
job_id = handler.path[16:]
job = handler.server.getJobID(job_id)
-
+
message = []
if job:
for slave_id in job.blacklist:
@@ -291,9 +291,9 @@ def get(handler):
message.append(slave.serialize())
sendjson(message)
# return all slaves currently assigned to a job
-
+
elif handler.path.startswith("/html/slavesjob_"):
-
+
job_id = handler.path[16:]
job = handler.server.getJobID(job_id)
message = []
@@ -301,8 +301,8 @@ def get(handler):
for slave in handler.server.slaves:
if slave.job and slave.job == job:
message.append(slave.serialize())
- sendjson(message)
- # here begin code for simple ui
+ sendjson(message)
+ # here begin code for simple ui
elif handler.path == "/html" or handler.path == "/":
handler.send_head(content = "text/html")
head("NetRender", refresh = True)
@@ -336,10 +336,10 @@ def get(handler):
for job in handler.server.jobs:
results = job.framesStatus()
-
+
time_finished = job.time_finished
time_started = job.time_started
-
+
rowTable(
"""<button title="cancel job" onclick="cancel_job('%s');">X</button>""" % job.id +
"""<button title="pause job" onclick="request('/pause_%s', null);">P</button>""" % job.id +
@@ -370,7 +370,7 @@ def get(handler):
)
endTable()
-
+
output("<h2>Slaves</h2>")
startTable()
@@ -383,7 +383,7 @@ def get(handler):
output("<h2>Configuration</h2>")
output("""<button title="remove all jobs" onclick="clear_jobs();">CLEAR JOB LIST</button>""")
-
+
output("<br />")
output(link("new interface", "/html/newui"))
@@ -427,7 +427,7 @@ def get(handler):
job_id = handler.path[9:]
head("NetRender")
-
+
output(link("Back to Main Page", "/html"))
job = handler.server.getJobID(job_id)
@@ -442,7 +442,7 @@ def get(handler):
rowTable("resolution", "%ix%i at %i%%" % job.resolution)
rowTable("tags", ";".join(sorted(job.tags)) if job.tags else "<i>None</i>")
-
+
rowTable("results", link("download all", resultURL(job_id)))
endTable()
@@ -450,29 +450,29 @@ def get(handler):
if job.type == netrender.model.JOB_BLENDER:
output("<h2>Files</h2>")
-
+
startTable()
headerTable("path")
-
+
tot_cache = 0
tot_fluid = 0
tot_other = 0
-
+
rowTable(job.files[0].original_path)
- tot_cache, tot_fluid, tot_other = countFiles(job)
-
+ tot_cache, tot_fluid, tot_other = countFiles(job)
+
if tot_cache > 0:
rowTable("%i physic cache files" % tot_cache, class_style = "toggle", extra = "onclick='toggleDisplay(&quot;.cache&quot;, &quot;none&quot;, &quot;table-row&quot;)'")
for file in job.files:
if file.filepath.endswith(".bphys"):
rowTable(os.path.split(file.filepath)[1], class_style = "cache")
-
+
if tot_fluid > 0:
rowTable("%i fluid bake files" % tot_fluid, class_style = "toggle", extra = "onclick='toggleDisplay(&quot;.fluid&quot;, &quot;none&quot;, &quot;table-row&quot;)'")
for file in job.files:
if file.filepath.endswith((".bobj.gz", ".bvel.gz")):
rowTable(os.path.split(file.filepath)[1], class_style = "fluid")
-
+
if tot_other > 0:
rowTable("%i other files" % tot_other, class_style = "toggle", extra = "onclick='toggleDisplay(&quot;.other&quot;, &quot;none&quot;, &quot;table-row&quot;)'")
for file in job.files:
@@ -487,15 +487,15 @@ def get(handler):
endTable()
elif job.type == netrender.model.JOB_VCS:
output("<h2>Versioning</h2>")
-
+
startTable()
-
+
rowTable("System", job.version_info.system.name)
rowTable("Remote Path", job.version_info.rpath)
rowTable("Working Path", job.version_info.wpath)
rowTable("Revision", job.version_info.revision)
rowTable("Render File", job.files[0].filepath)
-
+
endTable()
if job.blacklist:
@@ -524,10 +524,10 @@ def get(handler):
output("<h2>Frames</h2>")
startTable()
-
+
if job.hasRenderResult():
headerTable("no", "status", "render time", "slave", "log", "result", "")
-
+
for frame in job.frames:
rowTable(
frame.number,
@@ -541,7 +541,7 @@ def get(handler):
)
else:
headerTable("no", "status", "process time", "slave", "log")
-
+
for frame in job.frames:
rowTable(
frame.number,
diff --git a/netrender/model.py b/netrender/model.py
index 4153f936..62623da9 100644
--- a/netrender/model.py
+++ b/netrender/model.py
@@ -121,7 +121,7 @@ class RenderSlave:
self.total_done = 0
self.total_error = 0
self.last_seen = 0.0
-
+
if info:
self.name = info.name
self.address = info.address
@@ -176,7 +176,7 @@ class VersioningInfo:
self.wpath = ""
self.rpath = ""
self.revision = ""
-
+
@property
def system(self):
return self._system
@@ -187,7 +187,7 @@ class VersioningInfo:
def update(self):
self.system.update(self)
-
+
def serialize(self):
return {
"wpath": self.wpath,
@@ -195,7 +195,7 @@ class VersioningInfo:
"revision": self.revision,
"system": self.system.name
}
-
+
@staticmethod
def generate(system, path):
vs = VersioningInfo()
@@ -204,23 +204,23 @@ class VersioningInfo:
vs.rpath = vs.system.path(path)
vs.revision = vs.system.revision(path)
-
+
return vs
-
-
+
+
@staticmethod
def materialize(data):
if not data:
return None
-
+
vs = VersioningInfo()
vs.wpath = data["wpath"]
vs.rpath = data["rpath"]
vs.revision = data["revision"]
vs.system = data["system"]
-
+
return vs
-
+
class RenderFile:
def __init__(self, filepath = "", index = 0, start = -1, end = -1, signature = 0):
@@ -231,7 +231,7 @@ class RenderFile:
self.start = start
self.end = end
self.force = False
-
+
def serialize(self):
return {
@@ -242,7 +242,7 @@ class RenderFile:
"end": self.end,
"signature": self.signature,
"force": self.force
-
+
}
@staticmethod
@@ -259,16 +259,16 @@ class RenderFile:
class RenderJob:
def __init__(self, info = None):
self.id = ""
-
+
self.resolution = None
self.usage = 0.0
self.last_dispatched = 0.0
self.frames = []
self.transitions = []
-
+
self._status = None
-
+
if info:
self.type = info.type
self.subtype = info.subtype
@@ -300,13 +300,13 @@ class RenderJob:
def status(self):
"""Status of the job (waiting, paused, finished or queued)"""
return self._status
-
+
@status.setter
def status(self, value):
transition = JOB_TRANSITIONS.get((self.status, value), None)
if transition:
self.transitions.append((transition, time.time()))
-
+
self._status = value
@property
@@ -316,7 +316,7 @@ class RenderJob:
if transition == JOB_TRANSITION_STARTED:
started_time = time_value
break
-
+
return started_time
@property
@@ -326,7 +326,7 @@ class RenderJob:
for transition, time_value in self.transitions:
if transition == JOB_TRANSITION_FINISHED:
finished_time = time_value
-
+
return finished_time
def hasRenderResult(self):
@@ -339,15 +339,15 @@ class RenderJob:
def isFileInFrames():
if start == end == -1:
return True
-
+
for rframe in self.frames:
if start <= rframe.number<= end:
return True
-
+
return False
-
-
- if isFileInFrames():
+
+
+ if isFileInFrames():
if signed:
signature = hashFile(file_path)
else:
@@ -426,10 +426,10 @@ class RenderJob:
}
if (withFiles):
data["files"]=[f.serialize() for f in self.files if f.start == -1 or not frames or (f.start <= max_frame and f.end >= min_frame)]
-
+
if (withFrames):
data["frames"]=[f.serialize() for f in self.frames if not frames or f in frames]
-
+
return data
@staticmethod
def materialize(data):
@@ -454,7 +454,7 @@ class RenderJob:
job.last_dispatched = data["last_dispatched"]
job.resolution = data["resolution"]
job.render=data["render"]
-
+
version_info = data.get("version_info", None)
if version_info:
job.version_info = VersioningInfo.materialize(version_info)
diff --git a/netrender/operators.py b/netrender/operators.py
index bf0dfd61..c7012b39 100644
--- a/netrender/operators.py
+++ b/netrender/operators.py
@@ -51,7 +51,7 @@ class RENDER_OT_netclientsendbake(bpy.types.Operator):
self.report({'INFO'}, "Job sent to master")
except Exception as err:
self.report({'ERROR'}, str(err))
-
+
return {'FINISHED'}
def invoke(self, context, event):
@@ -389,26 +389,26 @@ class netclientdownload(bpy.types.Operator):
if conn:
job_id = netrender.jobs[netsettings.active_job_index].id
-
+
with ConnectionContext():
conn.request("GET", "/status", headers={"job-id":job_id})
response = conn.getresponse()
-
+
if response.status != http.client.OK:
self.report({'ERROR'}, "Job ID %i not defined on master" % job_id)
return {'ERROR'}
-
+
content = response.read()
-
+
job = netrender.model.RenderJob.materialize(json.loads(str(content, encoding='utf8')))
-
- conn.close()
-
+
+ conn.close()
+
finished_frames = []
-
+
nb_error = 0
nb_missing = 0
-
+
for frame in job.frames:
if frame.status == netrender.model.FRAME_DONE:
finished_frames.append(frame.number)
@@ -416,36 +416,36 @@ class netclientdownload(bpy.types.Operator):
nb_error += 1
else:
nb_missing += 1
-
+
if not finished_frames:
self.report({'ERROR'}, "Job doesn't have any finished frames")
return {'ERROR'}
-
+
frame_ranges = []
-
+
first = None
last = None
-
+
for i in range(len(finished_frames)):
current = finished_frames[i]
-
+
if not first:
first = current
last = current
elif last + 1 == current:
last = current
-
+
if last + 1 < current or i + 1 == len(finished_frames):
if first < last:
frame_ranges.append((first, last))
else:
frame_ranges.append((first,))
-
+
first = current
last = current
-
+
getResults(netsettings.server_address, netsettings.server_port, job_id, job.resolution[0], job.resolution[1], job.resolution[2], frame_ranges)
-
+
if nb_error and nb_missing:
self.report({'ERROR'}, "Results downloaded but skipped %i frames with errors and %i unfinished frames" % (nb_error, nb_missing))
elif nb_error:
@@ -495,20 +495,20 @@ class netclientvcsguess(bpy.types.Operator):
def execute(self, context):
netsettings = context.scene.network_render
-
+
system = versioning.SYSTEMS.get(netsettings.vcs_system, None)
-
+
if system:
wpath, name = os.path.split(os.path.abspath(bpy.data.filepath))
-
+
rpath = system.path(wpath)
revision = system.revision(wpath)
-
+
netsettings.vcs_wpath = wpath
netsettings.vcs_rpath = rpath
netsettings.vcs_revision = revision
-
-
+
+
return {'FINISHED'}
@@ -538,7 +538,7 @@ class netclientweb(bpy.types.Operator):
if netsettings.use_ssl:
webbrowser.open("https://%s:%i" % (netsettings.server_address, netsettings.server_port))
else:
- webbrowser.open("http://%s:%i" % (netsettings.server_address, netsettings.server_port))
+ webbrowser.open("http://%s:%i" % (netsettings.server_address, netsettings.server_port))
return {'FINISHED'}
def invoke(self, context, event):
diff --git a/netrender/repath.py b/netrender/repath.py
index e39929b4..348f7426 100644
--- a/netrender/repath.py
+++ b/netrender/repath.py
@@ -28,7 +28,7 @@ from netrender.utils import *
def reset(job):
main_file = job.files[0]
-
+
job_full_path = main_file.filepath
if os.path.exists(job_full_path + ".bak"):
@@ -37,27 +37,27 @@ def reset(job):
def update(job):
paths = []
-
+
main_file = job.files[0]
-
+
job_full_path = main_file.filepath
-
+
path, ext = os.path.splitext(job_full_path)
-
+
new_path = path + ".remap" + ext
-
- original_path = main_file.original_path
-
+
+ original_path = main_file.original_path
+
# Disable for now. Partial repath should work anyway
#all = main_file.filepath != main_file.original_path
- all = False
-
+ all = False
+
for rfile in job.files[1:]:
if all or rfile.original_path != rfile.filepath:
paths.append(rfile.original_path)
paths.append(rfile.filepath)
-
+
# Only update if needed
if paths:
process = subprocess.Popen(
@@ -75,7 +75,7 @@ def update(job):
stderr=subprocess.STDOUT,
)
process.wait()
-
+
os.renames(job_full_path, job_full_path + ".bak")
os.renames(new_path, job_full_path)
@@ -97,12 +97,12 @@ def process(original_path, paths):
else:
if DEBUG: print(paths[i], paths[i+1])
path_map[paths[i]] = paths[i+1]
-
+
if DEBUG: print("----------------------------------------------------------")
# TODO original paths aren't really the original path, they are the normalized path
- # so we repath using the filenames only.
-
+ # so we repath using the filenames only.
+
###########################
# LIBRARIES
###########################
@@ -123,7 +123,7 @@ def process(original_path, paths):
if DEBUG: print(file_path, new_path)
if new_path:
image.filepath = new_path
-
+
###########################
# FLUID + POINT CACHE
@@ -139,31 +139,31 @@ def process(original_path, paths):
point_cache.use_external = True
point_cache.filepath = new_path
point_cache.name = cache_name
-
+
def fluidFunc(object, modifier, cache_path):
fluid = modifier.settings
new_path = path_map.get(cache_path, None)
if new_path:
fluid.path = new_path
-
+
def multiresFunc(object, modifier, cache_path):
new_path = path_map.get(cache_path, None)
if new_path:
modifier.filepath = new_path
-
+
processObjectDependencies(pointCacheFunc, fluidFunc, multiresFunc)
if DEBUG: print("==========================================================")
-
+
if __name__ == "__main__":
try:
i = sys.argv.index("--")
except:
i = 0
-
+
if i:
new_path, original_path, *args = sys.argv[i+1:]
-
+
process(original_path, args)
-
+
bpy.ops.wm.save_as_mainfile(filepath=new_path, check_existing=False)
diff --git a/netrender/slave.py b/netrender/slave.py
index c20906a5..a5d97172 100644
--- a/netrender/slave.py
+++ b/netrender/slave.py
@@ -45,13 +45,13 @@ def slave_Info(netsettings):
slave.stats = sysname + " " + release + " " + machine + " " + processor
if netsettings.slave_tags:
slave.tags = set(netsettings.slave_tags.split(";"))
-
+
if netsettings.slave_bake:
slave.tags.add(netrender.model.TAG_BAKING)
-
+
if netsettings.slave_render:
slave.tags.add(netrender.model.TAG_RENDER)
-
+
return slave
def testCancel(conn, job_id, frame_number):
@@ -66,13 +66,13 @@ def testCancel(conn, job_id, frame_number):
def testFile(conn, job_id, slave_id, rfile, job_prefix, main_path=None):
job_full_path = createLocalPath(rfile, job_prefix, main_path, rfile.force)
-
+
found = os.path.exists(job_full_path)
-
+
if found and rfile.signature != None:
found_signature = hashFile(job_full_path)
found = found_signature == rfile.signature
-
+
if not found:
print("Found file %s at %s but signature mismatch!" % (rfile.filepath, job_full_path))
os.remove(job_full_path)
@@ -99,7 +99,7 @@ def testFile(conn, job_id, slave_id, rfile, job_prefix, main_path=None):
f.close()
os.renames(temp_path, job_full_path)
-
+
rfile.filepath = job_full_path
return job_full_path
@@ -114,7 +114,7 @@ def render_slave(engine, netsettings, threads):
bisleep = BreakableIncrementedSleep(INCREMENT_TIMEOUT, 1, MAX_TIMEOUT, engine.test_break)
engine.update_stats("", "Network render node initiation")
-
+
slave_path = bpy.path.abspath(netsettings.path)
if not os.path.exists(slave_path):
@@ -124,23 +124,23 @@ def render_slave(engine, netsettings, threads):
if not os.access(slave_path, os.W_OK):
print("Slave working path ( %s ) is not writable" % netsettings.path)
return
-
+
conn = clientConnection(netsettings)
-
+
if not conn:
print("Connection failed, will try connecting again at most %i times" % MAX_CONNECT_TRY)
bisleep.reset()
-
+
for i in range(MAX_CONNECT_TRY):
bisleep.sleep()
-
+
conn = clientConnection(netsettings)
-
+
if conn or engine.test_break():
break
-
+
print("Retry %i failed, waiting %is before retrying" % (i + 1, bisleep.current))
-
+
if conn:
with ConnectionContext():
conn.request("POST", "/slave", json.dumps(slave_Info(netsettings).serialize()))
@@ -184,7 +184,7 @@ def render_slave(engine, netsettings, threads):
for rfile in job.files[1:]:
testFile(conn, job.id, slave_id, rfile, job_prefix, main_path)
print("\t", rfile.filepath)
-
+
netrender.repath.update(job)
engine.update_stats("", "Render File " + main_file + " for job " + job.id)
@@ -192,15 +192,15 @@ def render_slave(engine, netsettings, threads):
if not job.version_info:
# Need to return an error to server, incorrect job type
pass
-
+
job_path = job.files[0].filepath # path of main file
main_path, main_file = os.path.split(job_path)
-
+
job.version_info.update()
-
+
# For VCS jobs, file path is relative to the working copy path
job_full_path = os.path.join(job.version_info.wpath, job_path)
-
+
engine.update_stats("", "Render File " + main_file + " for job " + job.id)
# announce log to master
@@ -238,26 +238,26 @@ def render_slave(engine, netsettings, threads):
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
-
+
elif job.subtype == netrender.model.JOB_SUB_BAKING:
tasks = []
for frame in job.frames:
tasks.append(netrender.baking.commandToTask(frame.command))
-
+
with NoErrorDialogContext():
process = netrender.baking.bake(job, tasks)
-
+
elif job.type == netrender.model.JOB_PROCESS:
command = job.frames[0].command
with NoErrorDialogContext():
process = subprocess.Popen(command.split(" "), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
headers = {"slave-id":slave_id}
-
+
results = []
line = ""
-
+
class ProcessData:
def __init__(self):
self.lock = threading.Lock()
@@ -265,21 +265,21 @@ def render_slave(engine, netsettings, threads):
self.cancelled = False
self.start_time = time.time()
self.last_time = time.time()
-
+
data = ProcessData()
-
+
def run_process(process, data):
while not data.cancelled and process.poll() is None:
buf = process.stdout.read(1024)
-
+
data.lock.acquire()
data.stdout += buf
data.lock.release()
-
+
process_thread = threading.Thread(target=run_process, args=(process, data))
-
+
process_thread.start()
-
+
while not data.cancelled and process_thread.is_alive():
time.sleep(CANCEL_POLL_SPEED / 2)
current_time = time.time()
@@ -294,13 +294,13 @@ def render_slave(engine, netsettings, threads):
with ConnectionContext():
conn.request("PUT", logURL(job.id, first_frame), data.stdout, headers=headers)
responseStatus(conn)
-
+
stdout_text = str(data.stdout, encoding='utf8')
-
+
# Also output on console
if netsettings.use_slave_output_log:
print(stdout_text, end="")
-
+
lines = stdout_text.split("\n")
lines[0] = line + lines[0]
line = lines.pop()
@@ -308,14 +308,14 @@ def render_slave(engine, netsettings, threads):
results.extend(netrender.baking.resultsFromOuput(lines))
data.stdout = bytes()
-
+
data.lock.release()
data.last_time = current_time
if testCancel(conn, job.id, first_frame):
engine.update_stats("", "Job canceled by Master")
data.cancelled = True
-
+
process_thread.join()
del process_thread
@@ -337,11 +337,11 @@ def render_slave(engine, netsettings, threads):
# flush the rest of the logs
if data.stdout:
stdout_text = str(data.stdout, encoding='utf8')
-
+
# Also output on console
if netsettings.use_slave_output_log:
print(stdout_text, end="")
-
+
lines = stdout_text.split("\n")
lines[0] = line + lines[0]
if job.subtype == netrender.model.JOB_SUB_BAKING:
@@ -350,7 +350,7 @@ def render_slave(engine, netsettings, threads):
# (only need to update on one frame, they are linked
with ConnectionContext():
conn.request("PUT", logURL(job.id, first_frame), data.stdout, headers=headers)
-
+
if responseStatus(conn) == http.client.NO_CONTENT:
continue
@@ -377,7 +377,7 @@ def render_slave(engine, netsettings, threads):
# thumbnail first
if netsettings.use_slave_thumb:
thumbname = thumbnail.generate(filename)
-
+
if thumbname:
f = open(thumbname, 'rb')
with ConnectionContext():
@@ -394,21 +394,21 @@ def render_slave(engine, netsettings, threads):
elif job.subtype == netrender.model.JOB_SUB_BAKING:
index = job.frames.index(frame)
-
+
frame_results = [result_filepath for task_index, result_filepath in results if task_index == index]
-
+
for result_filepath in frame_results:
result_path, result_filename = os.path.split(result_filepath)
headers["result-filename"] = result_filename
headers["job-finished"] = str(result_filepath == frame_results[-1])
-
+
f = open(result_filepath, 'rb')
with ConnectionContext():
conn.request("PUT", "/result", f, headers=headers)
f.close()
if responseStatus(conn) == http.client.NO_CONTENT:
continue
-
+
elif job.type == netrender.model.JOB_PROCESS:
with ConnectionContext():
conn.request("PUT", "/render", headers=headers)
diff --git a/netrender/thumbnail.py b/netrender/thumbnail.py
index 4408599e..0c72356d 100644
--- a/netrender/thumbnail.py
+++ b/netrender/thumbnail.py
@@ -38,7 +38,7 @@ def generate(filename, external=True):
while process.poll() is None:
process.stdout.read(1024) # empty buffer to be sure
process.stdout.read()
-
+
return _thumbname(filename)
else:
return _internal(filename)
@@ -58,7 +58,7 @@ def _internal(filename):
scene = bpy.data.scenes[0] # FIXME, this is dodgy!
scene.render.image_settings.file_format = "JPEG"
scene.render.image_settings.quality = 90
-
+
# remove existing image, if there's a leftover (otherwise open changes the name)
if imagename in bpy.data.images:
img = bpy.data.images[imagename]
@@ -66,9 +66,9 @@ def _internal(filename):
bpy.ops.image.open(filepath=filename)
img = bpy.data.images[imagename]
-
+
img.save_render(thumbname, scene=scene)
-
+
img.user_clear()
bpy.data.images.remove(img)
diff --git a/netrender/ui.py b/netrender/ui.py
index 2b352a5e..7f65163f 100644
--- a/netrender/ui.py
+++ b/netrender/ui.py
@@ -36,7 +36,7 @@ ADDRESS_TEST_TIMEOUT = 30
def base_poll(cls, context):
rd = context.scene.render
return (rd.use_game_engine==False) and (rd.engine in cls.COMPAT_ENGINES)
-
+
def init_file():
if netrender.init_file != bpy.data.filepath:
@@ -79,7 +79,7 @@ def verify_address(netsettings, force=False):
conn.close()
else:
netrender.valid_address = False
-
+
return netrender.valid_address
class NeedValidAddress():
@@ -92,11 +92,11 @@ class NetRenderButtonsPanel():
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 rd.engine == 'NET_RENDER' and rd.use_game_engine == False
+ return rd.engine == 'NET_RENDER' and rd.use_game_engine == False
# Setting panel, use in the scene for now.
class RENDER_PT_network_settings(NetRenderButtonsPanel, bpy.types.Panel):
@@ -120,7 +120,7 @@ class RENDER_PT_network_settings(NetRenderButtonsPanel, bpy.types.Panel):
layout.operator("render.netclientstart", icon='PLAY')
layout.prop(netsettings, "path")
-
+
row = layout.row()
split = layout.split(percentage=0.5)
@@ -135,19 +135,19 @@ class RENDER_PT_network_settings(NetRenderButtonsPanel, bpy.types.Panel):
if netsettings.mode != "RENDER_MASTER":
layout.operator("render.netclientscan", icon='FILE_REFRESH', text="")
-
+
if not netrender.valid_address:
layout.label(text="No master at specified address")
-
-
+
+
if netsettings.use_ssl and netsettings.mode == "RENDER_MASTER":
layout.prop(netsettings, "cert_path", text="Certificate")
layout.prop(netsettings, "key_path", text="Key")
layout.operator("render.netclientweb", icon='QUESTION')
-
-
+
+
class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel):
bl_label = "Slave Settings"
COMPAT_ENGINES = {'NET_RENDER'}
@@ -171,7 +171,7 @@ class RENDER_PT_network_slave_settings(NetRenderButtonsPanel, bpy.types.Panel):
layout.prop(netsettings, "use_slave_output_log")
layout.label(text="Threads:")
layout.prop(rd, "threads_mode", expand=True)
-
+
col = layout.column()
col.enabled = rd.threads_mode == 'FIXED'
col.prop(rd, "threads")
@@ -225,18 +225,18 @@ class RENDER_PT_network_job(NetRenderButtonsPanel, bpy.types.Panel):
layout.prop(netsettings, "job_category", text="Category")
layout.prop(netsettings, "job_tags", text="Tags")
layout.prop(netsettings, "job_render_engine", text="Engine")
-
+
if netsettings.job_render_engine == "OTHER":
layout.prop(netsettings, "job_render_engine_other", text="Other Engine")
row = layout.row()
row.prop(netsettings, "priority")
row.prop(netsettings, "chunks")
-
+
if netsettings.job_type == "JOB_BLENDER":
layout.prop(netsettings, "save_before_job")
-
-
+
+
class RENDER_PT_network_job_vcs(NetRenderButtonsPanel, bpy.types.Panel):
bl_label = "VCS Job Settings"
@@ -366,7 +366,7 @@ class RENDER_PT_network_output(NeedValidAddress, NetRenderButtonsPanel, bpy.type
def poll(cls, context):
netsettings = context.scene.network_render
return super().poll(context) and netsettings.mode == "RENDER_CLIENT"
-
+
draw = properties_render.RENDER_PT_output.draw
@@ -404,14 +404,14 @@ class NetRenderSettings(bpy.types.PropertyGroup):
maxlen = 128,
default = "[default]",
update = address_update_callback)
-
+
NetRenderSettings.server_port = IntProperty(
name="Server port",
description="port of the master render server",
default = 8000,
min=1,
max=65535)
-
+
NetRenderSettings.use_master_broadcast = BoolProperty(
name="Broadcast",
description="broadcast master server address on local network",
@@ -432,17 +432,17 @@ class NetRenderSettings(bpy.types.PropertyGroup):
maxlen = 128,
default = "",
subtype='FILE_PATH')
-
+
NetRenderSettings.use_slave_clear = BoolProperty(
name="Clear on exit",
description="delete downloaded files on exit",
default = True)
-
+
NetRenderSettings.use_slave_thumb = BoolProperty(
name="Generate thumbnails",
description="Generate thumbnails on slaves instead of master",
default = False)
-
+
NetRenderSettings.slave_tags = StringProperty(
name="Tags",
description="Tags to associate with the slave (semi-colon separated)",
@@ -453,7 +453,7 @@ class NetRenderSettings(bpy.types.PropertyGroup):
name="Output render log on console",
description="Output render text log to console as well as sending it to the master",
default = True)
-
+
NetRenderSettings.slave_render = BoolProperty(
name="Render on slave",
description="Use slave for render jobs",
@@ -473,9 +473,9 @@ class NetRenderSettings(bpy.types.PropertyGroup):
name="Force Dependency Upload",
description="Force client to upload dependency files to master",
default = False)
-
+
default_path = os.environ.get("TEMP")
-
+
if not default_path:
if os.name == 'nt':
default_path = "c:/tmp/"
@@ -483,14 +483,14 @@ class NetRenderSettings(bpy.types.PropertyGroup):
default_path = "/tmp/"
elif not default_path.endswith(os.sep):
default_path += os.sep
-
+
NetRenderSettings.path = StringProperty(
name="Path",
description="Path for temporary files",
maxlen = 128,
default = default_path,
subtype='FILE_PATH')
-
+
NetRenderSettings.job_type = EnumProperty(
items=(
("JOB_BLENDER", "Blender", "Standard Blender Job"),
@@ -500,13 +500,13 @@ class NetRenderSettings(bpy.types.PropertyGroup):
name="Job Type",
description="Type of render job",
default="JOB_BLENDER")
-
+
NetRenderSettings.job_name = StringProperty(
name="Job name",
description="Name of the job",
maxlen = 128,
default = "[default]")
-
+
NetRenderSettings.job_category = StringProperty(
name="Job category",
description="Category of the job",
@@ -534,7 +534,7 @@ class NetRenderSettings(bpy.types.PropertyGroup):
description="Render engine other than the builtin defaults (POVRAY_RENDER, ...)",
maxlen = 128,
default = "")
-
+
NetRenderSettings.save_before_job = BoolProperty(
name="Save Before Job",
description="Save current file before sending a job",
@@ -546,65 +546,65 @@ class NetRenderSettings(bpy.types.PropertyGroup):
default = 5,
min=1,
max=65535)
-
+
NetRenderSettings.priority = IntProperty(
name="Priority",
description="Priority of the job",
default = 1,
min=1,
max=10)
-
+
NetRenderSettings.vcs_wpath = StringProperty(
name="Working Copy",
description="Path of the local working copy",
maxlen = 1024,
default = "")
-
+
NetRenderSettings.vcs_rpath = StringProperty(
name="Remote Path",
description="Path of the server copy (protocol specific)",
maxlen = 1024,
default = "")
-
+
NetRenderSettings.vcs_revision = StringProperty(
name="Revision",
description="Revision for this job",
maxlen = 256,
default = "")
-
+
NetRenderSettings.vcs_system = EnumProperty(
items= netrender.versioning.ITEMS,
name="VCS mode",
description="Version Control System",
default=netrender.versioning.ITEMS[0][0])
-
+
NetRenderSettings.job_id = StringProperty(
name="Network job id",
description="id of the last sent render job",
maxlen = 64,
default = "")
-
+
NetRenderSettings.active_slave_index = IntProperty(
name="Index of the active slave",
description="",
default = -1,
min= -1,
max=65535)
-
+
NetRenderSettings.active_blacklisted_slave_index = IntProperty(
name="Index of the active slave",
description="",
default = -1,
min= -1,
max=65535)
-
+
NetRenderSettings.active_job_index = IntProperty(
name="Index of the active job",
description="",
default = -1,
min= -1,
max=65535)
-
+
NetRenderSettings.mode = EnumProperty(
items=(
("RENDER_CLIENT", "Client", "Act as render client"),
@@ -614,11 +614,11 @@ class NetRenderSettings(bpy.types.PropertyGroup):
name="Network mode",
description="Mode of operation of this instance",
default="RENDER_CLIENT")
-
+
NetRenderSettings.slaves = CollectionProperty(type=NetRenderSlave, name="Slaves", description="")
NetRenderSettings.slaves_blacklist = CollectionProperty(type=NetRenderSlave, name="Slaves Blacklist", description="")
NetRenderSettings.jobs = CollectionProperty(type=NetRenderJob, name="Job List", description="")
-
+
bpy.types.Scene.network_render = PointerProperty(type=NetRenderSettings, name="Network Render", description="Network Render Settings")
@classmethod
diff --git a/netrender/utils.py b/netrender/utils.py
index edade26f..78d57487 100644
--- a/netrender/utils.py
+++ b/netrender/utils.py
@@ -42,7 +42,7 @@ if system == "Darwin":
def __init__(self, timeout = None):
self.old_timeout = socket.getdefaulttimeout()
self.timeout = timeout
-
+
def __enter__(self):
if self.old_timeout != self.timeout:
socket.setdefaulttimeout(self.timeout)
@@ -54,7 +54,7 @@ else:
class ConnectionContext:
def __init__(self, timeout = None):
pass
-
+
def __enter__(self):
pass
@@ -66,7 +66,7 @@ if system in {"Windows", "win32"}:
class NoErrorDialogContext:
def __init__(self):
self.val = 0
-
+
def __enter__(self):
self.val = ctypes.windll.kernel32.SetErrorMode(0x0002)
ctypes.windll.kernel32.SetErrorMode(self.val | 0x0002)
@@ -77,7 +77,7 @@ else:
class NoErrorDialogContext:
def __init__(self):
pass
-
+
def __enter__(self):
pass
@@ -87,7 +87,7 @@ else:
class DirectoryContext:
def __init__(self, path):
self.path = path
-
+
def __enter__(self):
self.curdir = os.path.abspath(os.curdir)
os.chdir(self.path)
@@ -102,19 +102,19 @@ class BreakableIncrementedSleep:
self.max = max_timeout
self.current = self.default
self.break_fct = break_fct
-
+
def reset(self):
self.current = self.default
def increase(self):
self.current = min(self.current + self.increment, self.max)
-
+
def sleep(self):
for i in range(self.current):
time.sleep(1)
if self.break_fct():
break
-
+
self.increase()
def responseStatus(conn):
@@ -163,7 +163,7 @@ def clientConnection(netsettings, report = None, scan = True, timeout = 50):
address = netsettings.server_address
port = netsettings.server_port
use_ssl = netsettings.use_ssl
-
+
if address== "[default]":
# calling operator from python is fucked, scene isn't in context
# if bpy:
@@ -236,7 +236,7 @@ def hashFile(path):
value = hashData(f.read())
f.close()
return value
-
+
def hashData(data):
m = hashlib.md5()
m.update(data)
@@ -257,13 +257,13 @@ def verifyCreateDir(directory_path):
if original_path != directory_path:
print("Expanded from the following path:", original_path)
raise
-
+
def cacheName(ob, point_cache):
name = point_cache.name
if name == "":
name = "".join(["%02X" % ord(c) for c in ob.name])
-
+
return name
def cachePath(file_path):
@@ -291,12 +291,12 @@ def processObjectDependencies(pointCacheFunction, fluidFunction, multiresFunctio
elif modifier.type == "DYNAMIC_PAINT" and modifier.canvas_settings:
for surface in modifier.canvas_settings.canvas_surfaces:
pointCacheFunction(object, modifier, surface.point_cache)
-
+
# particles modifier are stupid and don't contain data
# we have to go through the object property
for psys in object.particle_systems:
pointCacheFunction(object, psys, psys.point_cache)
-
+
def createLocalPath(rfile, prefixdirectory, prefixpath, forcelocal):
filepath = rfile.original_path
@@ -309,12 +309,12 @@ def createLocalPath(rfile, prefixdirectory, prefixpath, forcelocal):
finalpath = filepath
if forcelocal or not os.path.exists(finalpath):
path, name = os.path.split(os.path.normpath(finalpath))
-
+
# Don't add signatures to cache files, relink fails otherwise
if not name.endswith(".bphys") and not name.endswith(".bobj.gz"):
name, ext = os.path.splitext(name)
name = name + "_" + rfile.signature + ext
-
+
if prefixpath and path.startswith(prefixpath):
suffix = ""
while path != prefixpath:
@@ -334,7 +334,7 @@ def createLocalPath(rfile, prefixdirectory, prefixpath, forcelocal):
if not name.endswith(".bphys") and not name.endswith(".bobj.gz"):
name, ext = os.path.splitext(name)
name = name + "_" + rfile.signature + ext
-
+
directory = directory.replace("../")
directory = os.path.join(prefixdirectory, directory)
@@ -355,7 +355,7 @@ def getResults(server_address, server_port, job_id, resolution_x, resolution_y,
frame_arguments.extend(["-s", str(r[0]), "-e", str(r[1]), "-a"])
else:
frame_arguments.extend(["-f", str(r[0])])
-
+
filepath = os.path.join(bpy.app.tempdir, "netrender_temp.blend")
bpy.ops.wm.save_as_mainfile(filepath=filepath, copy=True, check_existing=False)
@@ -387,22 +387,22 @@ def getResults(server_address, server_port, job_id, resolution_x, resolution_y,
stdout = process.stdout.read(1024)
if bpy.app.debug:
print(str(stdout, encoding='utf-8'), end="")
-
+
# read leftovers if needed
stdout = process.stdout.read()
if bpy.app.debug:
print(str(stdout, encoding='utf-8'))
-
+
os.remove(filepath)
-
+
if bpy.app.debug:
print("=============================================")
return
def _getResults(server_address, server_port, job_id, resolution_x, resolution_y, resolution_percentage):
render = bpy.context.scene.render
-
+
netsettings = bpy.context.scene.network_render
netsettings.server_address = server_address
@@ -417,7 +417,7 @@ def _getResults(server_address, server_port, job_id, resolution_x, resolution_y,
render.use_full_sample = False
render.use_compositing = False
render.use_border = False
-
+
def getFileInfo(filepath, infos):
process = subprocess.Popen(
@@ -445,7 +445,7 @@ def getFileInfo(filepath, infos):
values = [eval(v[1:].strip()) for v in stdout.split("\n") if v.startswith("$")]
return values
-
+
if __name__ == "__main__":
try:
@@ -453,8 +453,8 @@ if __name__ == "__main__":
except ValueError:
start = 0
action, *args = sys.argv[start:]
-
- if action == "FileInfo":
+
+ if action == "FileInfo":
for info in args:
print("$", eval(info))
elif action == "GetResults":
diff --git a/netrender/versioning.py b/netrender/versioning.py
index e88416cd..871fe687 100644
--- a/netrender/versioning.py
+++ b/netrender/versioning.py
@@ -23,34 +23,34 @@ import subprocess
from netrender.utils import *
class AbstractVCS:
- name = "ABSTRACT VCS"
+ name = "ABSTRACT VCS"
def __init__(self):
pass
-
+
def update(self, info):
"""update(info)
Update a working copy to the specified revision.
If working copy doesn't exist, do a full get from server to create it.
[info] model.VersioningInfo instance, specifies the working path, remote path and version number."""
pass
-
+
def revision(self, path):
"""revision(path)
return the current revision of the specified working copy path"""
pass
-
+
def path(self, path):
"""path(path)
return the remote path of the specified working copy path"""
pass
-
+
class Subversion(AbstractVCS):
name = "Subversion"
description = "Use the Subversion version control system"
def __init__(self):
super().__init__()
- self.version_exp = re.compile("([0-9]*)")
- self.path_exp = re.compile("URL: (.*)")
+ self.version_exp = re.compile("([0-9]*)")
+ self.path_exp = re.compile("URL: (.*)")
def update(self, info):
if not os.path.exists(info.wpath):
@@ -61,28 +61,28 @@ class Subversion(AbstractVCS):
else:
with DirectoryContext(info.wpath):
subprocess.call(["svn", "up", "--accept", "theirs-full", "-r", str(info.revision)])
-
+
def revision(self, path):
if not os.path.exists(path):
return
with DirectoryContext(path):
stdout = subprocess.check_output(["svnversion"])
-
+
match = self.version_exp.match(str(stdout, encoding="utf-8"))
-
+
if match:
return match.group(1)
-
+
def path(self, path):
if not os.path.exists(path):
return
with DirectoryContext(path):
stdout = subprocess.check_output(["svn", "info"])
-
+
match = self.path_exp.search(str(stdout, encoding="utf-8"))
-
+
if match:
return match.group(1)
@@ -91,7 +91,7 @@ class Git(AbstractVCS):
description = "Use the Git distributed version control system"
def __init__(self):
super().__init__()
- self.version_exp = re.compile("^commit (.*)")
+ self.version_exp = re.compile("^commit (.*)")
def update(self, info):
if not os.path.exists(info.wpath):
@@ -102,19 +102,19 @@ class Git(AbstractVCS):
with DirectoryContext(info.wpath):
subprocess.call(["git", "checkout", str(info.revision)])
-
+
def revision(self, path):
if not os.path.exists(path):
return
with DirectoryContext(path):
stdout = subprocess.check_output(["git", "show"])
-
+
match = self.version_exp.search(str(stdout, encoding="utf-8"))
-
+
if match:
return match.group(1)
-
+
def path(self, path):
if not os.path.exists(path):
return
diff --git a/node_wrangler.py b/node_wrangler.py
index b7425e69..465e3162 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -1059,12 +1059,12 @@ class NWNodeWrangler(bpy.types.AddonPreferences):
def nw_check(context):
space = context.space_data
valid_trees = ["ShaderNodeTree", "CompositorNodeTree", "TextureNodeTree"]
-
+
valid = False
if space.type == 'NODE_EDITOR' and space.node_tree is not None and space.tree_type in valid_trees:
valid = True
-
- return valid
+
+ return valid
class NWBase:
@classmethod
@@ -2296,7 +2296,7 @@ class NWCopySettings(Operator, NWBase):
def execute(self, context):
node_active = context.active_node
node_selected = context.selected_nodes
-
+
# Error handling
if not (len(node_selected) > 1):
self.report({'ERROR'}, "2 nodes must be selected at least")
@@ -2314,14 +2314,14 @@ class NWCopySettings(Operator, NWBase):
if not (len(valid_nodes) > 1) and node_active:
self.report({'ERROR'}, "Selected nodes are not of the same type as {}".format(node_active.name))
return {'CANCELLED'}
-
+
if len(valid_nodes) != len(node_selected):
# Report nodes that are not valid
valid_node_names = [n.name for n in valid_nodes]
not_valid_names = list(set(selected_node_names) - set(valid_node_names))
self.report({'INFO'}, "Ignored {} (not of the same type as {})".format(", ".join(not_valid_names), node_active.name))
- # Reference original
+ # Reference original
orig = node_active
#node_selected_names = [n.name for n in node_selected]
@@ -2331,43 +2331,43 @@ class NWCopySettings(Operator, NWBase):
# Deselect all nodes
for i in node_selected:
i.select = False
-
+
# Code by zeffii from http://blender.stackexchange.com/a/42338/3710
# Run through all other nodes
for node in valid_nodes[1:]:
-
+
# Check for frame node
parent = node.parent if node.parent else None
node_loc = [node.location.x, node.location.y]
# Select original to duplicate
orig.select = True
-
+
# Duplicate selected node
bpy.ops.node.duplicate()
new_node = context.selected_nodes[0]
-
+
# Deselect copy
- new_node.select = False
-
+ new_node.select = False
+
# Properties to copy
node_tree = node.id_data
props_to_copy = 'bl_idname name location height width'.split(' ')
-
+
# Input and outputs
reconnections = []
mappings = chain.from_iterable([node.inputs, node.outputs])
for i in (i for i in mappings if i.is_linked):
for L in i.links:
reconnections.append([L.from_socket.path_from_id(), L.to_socket.path_from_id()])
-
+
# Properties
props = {j: getattr(node, j) for j in props_to_copy}
props_to_copy.pop(0)
-
+
for prop in props_to_copy:
setattr(new_node, prop, props[prop])
-
+
# Get the node tree to remove the old node
nodes = node_tree.nodes
nodes.remove(node)
@@ -2376,10 +2376,10 @@ class NWCopySettings(Operator, NWBase):
if parent:
new_node.parent = parent
new_node.location = node_loc
-
+
for str_from, str_to in reconnections:
node_tree.links.new(eval(str_from), eval(str_to))
-
+
success_names.append(new_node.name)
orig.select = True
@@ -2755,7 +2755,7 @@ class NWAlignNodes(Operator, NWBase):
def execute(self, context):
nodes, links = get_nodes_links(context)
margin = self.margin
-
+
selection = []
for node in nodes:
if node.select and node.type != 'FRAME':
@@ -2984,7 +2984,7 @@ class NWAddSequence(Operator, ImportHelper):
bl_label = 'Import Image Sequence'
bl_options = {'REGISTER', 'UNDO'}
directory = StringProperty(subtype="DIR_PATH")
- filename = StringProperty(subtype="FILE_NAME")
+ filename = StringProperty(subtype="FILE_NAME")
files = CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'})
def execute(self, context):
@@ -3082,7 +3082,7 @@ class NWAddMultipleImages(Operator, ImportHelper):
def execute(self, context):
nodes, links = get_nodes_links(context)
-
+
xloc, yloc = context.region.view2d.region_to_view(context.area.width/2, context.area.height/2)
if context.space_data.node_tree.type == 'SHADER':
@@ -3154,7 +3154,7 @@ class NWViewerFocus(bpy.types.Operator):
region_center_x = context.region.width / 2
region_center_y = context.region.height / 2
-
+
bd_x = render.resolution_x * percent * space.backdrop_zoom
bd_y = render.resolution_y * percent * space.backdrop_zoom
@@ -3166,7 +3166,7 @@ class NWViewerFocus(bpy.types.Operator):
abs_mouse_x = (mlocx - margin_x) / bd_x
abs_mouse_y = (mlocy - margin_y) / bd_y
-
+
for node in viewers:
node.center_x = abs_mouse_x
node.center_y = abs_mouse_y
@@ -3251,7 +3251,7 @@ class NWResetNodes(bpy.types.Operator):
node_active = context.active_node
node_selected = context.selected_nodes
node_ignore = ["FRAME","REROUTE", "GROUP"]
-
+
# Check if one node is selected at least
if not (len(node_selected) > 0):
self.report({'ERROR'}, "1 node must be selected at least")
@@ -3259,7 +3259,7 @@ class NWResetNodes(bpy.types.Operator):
active_node_name = node_active.name if node_active.select else None
valid_nodes = [n for n in node_selected if n.type not in node_ignore]
-
+
# Create output lists
selected_node_names = [n.name for n in node_selected]
success_names = []
@@ -3273,7 +3273,7 @@ class NWResetNodes(bpy.types.Operator):
valid_nodes = [n for n in children if n.type not in node_ignore]
selected_node_names = [n.name for n in children if n.type not in node_ignore]
node_active_is_frame = True
-
+
# Check if valid nodes in selection
if not (len(valid_nodes) > 0):
# Check for frames only
@@ -3295,7 +3295,7 @@ class NWResetNodes(bpy.types.Operator):
i.select = False
# Run through all valid nodes
- for node in valid_nodes:
+ for node in valid_nodes:
parent = node.parent if node.parent else None
node_loc = [node.location.x, node.location.y]
@@ -4106,7 +4106,7 @@ def multipleimages_menu_func(self, context):
col.operator(NWAddMultipleImages.bl_idname, text="Multiple Images")
col.operator(NWAddSequence.bl_idname, text="Image Sequence")
col.separator()
-
+
def bgreset_menu_func(self, context):
self.layout.operator(NWResetBG.bl_idname)
@@ -4130,7 +4130,7 @@ def reset_nodes_button(self, context):
row = self.layout.row()
row.operator("node.nw_reset_nodes", text="Reset Node", icon="FILE_REFRESH")
self.layout.separator()
-
+
elif (len(node_selected) == 1) and node_active.select and node_active.type == "FRAME":
row = self.layout.row()
row.operator("node.nw_reset_nodes", text="Reset Nodes in Frame", icon="FILE_REFRESH")
diff --git a/object_animrenderbake.py b/object_animrenderbake.py
index 552ac80c..cf660149 100644
--- a/object_animrenderbake.py
+++ b/object_animrenderbake.py
@@ -59,7 +59,7 @@ class OBJECT_OT_animrenderbake(bpy.types.Operator):
if start >= end:
self.report({'ERROR'}, "Start frame must be smaller than end frame")
return {'CANCELLED'}
-
+
selected = context.selected_objects
# Only single object baking for now
diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index b780d644..f0b2669f 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -704,7 +704,7 @@ class Auto_Slice(AutoBoolean, Operator):
scene.objects.active = obj_copy
self.boolean_mod(obj_copy, ob, 'INTERSECT')
obj_copy.select = True
-
+
return {'FINISHED'}
@@ -1146,7 +1146,7 @@ class BoolTool_BViwer(Panel):
Dw = row.operator("btool.move_stack", icon="TRIA_DOWN", emboss=False)
Dw.modif = mod.name
Dw.direction = "DOWN"
-
+
# ------------------ BOOL TOOL Help ----------------------------
class BoolTool_help(bpy.types.Operator):
bl_idname = 'help.bool_tool'
@@ -1213,7 +1213,7 @@ class BoolTool_Pref(AddonPreferences):
default=False,
description="When Apply a Brush to de Object it will create a new vertex group of the bondary boolean area",
)
-
+
use_wire = BoolProperty(
name="Use Bmesh",
default=False,
diff --git a/object_cloud_gen.py b/object_cloud_gen.py
index 84c9379a..0c2817da 100644
--- a/object_cloud_gen.py
+++ b/object_cloud_gen.py
@@ -39,13 +39,13 @@ from bpy.types import Operator, Panel
def CreateNodeGroup(Type):
# Look for NodeTree if it already exists return it
-
+
CreateGroup = True
for Group in bpy.data.node_groups:
if Group.name == Type:
CreateGroup = False
NodeGroup = Group
-
+
if CreateGroup == True:
NodeGroup = bpy.data.node_groups.new(name=Type,type="ShaderNodeTree")
NodeGroup.name = Type
@@ -81,7 +81,7 @@ def CreateNodeGroup(Type):
MathGreaterThan.location = [-1200,600]
MathGreaterThan.operation = 'GREATER_THAN'
MathGreaterThan.inputs[1].default_value = 0
-
+
NodeGroup.links.new(AddAddAndEmission.inputs[0],AddAbsorptionAndScatter.outputs[0])
NodeGroup.links.new(AddAddAndEmission.inputs[1],VolumeEmission.outputs[0])
NodeGroup.links.new(AddAbsorptionAndScatter.inputs[0],VolumeAbsorption.outputs[0])
@@ -93,34 +93,34 @@ def CreateNodeGroup(Type):
NodeGroup.links.new(MathScatterMultiply.inputs[0],MathGreaterThan.outputs[0])
NodeGroup.links.new(MathEmissionMultiply.inputs[0],MathGreaterThan.outputs[0])
NodeGroup.links.new(VolumeAbsorption.inputs[0],MathBrightnessMultiply.outputs[0])
-
+
# Create and Link In/Out to Group Node
# Outputs
group_outputs = NodeGroup.nodes.new('NodeGroupOutput')
group_outputs.location = (600,395)
- NodeGroup.outputs.new('NodeSocketShader','shader_out')
- NodeGroup.links.new(AddAddAndEmission.outputs[0],group_outputs.inputs['shader_out'])
-
+ NodeGroup.outputs.new('NodeSocketShader','shader_out')
+ NodeGroup.links.new(AddAddAndEmission.outputs[0],group_outputs.inputs['shader_out'])
+
# Inputs
group_inputs = NodeGroup.nodes.new('NodeGroupInput')
group_inputs.location = (-1500,-300)
- NodeGroup.inputs.new('NodeSocketFloat','Density')
- NodeGroup.inputs.new('NodeSocketFloat','Absorption Multiply')
- NodeGroup.inputs.new('NodeSocketColor','Absorption Color')
- NodeGroup.inputs.new('NodeSocketFloat','Scatter Multiply')
- NodeGroup.inputs.new('NodeSocketColor','Scatter Color')
- NodeGroup.inputs.new('NodeSocketFloat','Emission Amount')
- NodeGroup.inputs.new('NodeSocketFloat','Cloud Brightness')
-
- NodeGroup.links.new(group_inputs.outputs['Density'],MathGreaterThan.inputs[0])
- NodeGroup.links.new(group_inputs.outputs['Absorption Multiply'],MathAbsorptionMultiply.inputs[1])
- NodeGroup.links.new(group_inputs.outputs['Absorption Color'],MathBrightnessMultiply.inputs[0])
- NodeGroup.links.new(group_inputs.outputs['Scatter Multiply'],MathScatterMultiply.inputs[1])
- NodeGroup.links.new(group_inputs.outputs['Scatter Color'],VolumeScatter.inputs[0])
- NodeGroup.links.new(group_inputs.outputs['Emission Amount'],MathEmissionMultiply.inputs[1])
- NodeGroup.links.new(group_inputs.outputs['Cloud Brightness'],MathBrightnessMultiply.inputs[1])
-
-
+ NodeGroup.inputs.new('NodeSocketFloat','Density')
+ NodeGroup.inputs.new('NodeSocketFloat','Absorption Multiply')
+ NodeGroup.inputs.new('NodeSocketColor','Absorption Color')
+ NodeGroup.inputs.new('NodeSocketFloat','Scatter Multiply')
+ NodeGroup.inputs.new('NodeSocketColor','Scatter Color')
+ NodeGroup.inputs.new('NodeSocketFloat','Emission Amount')
+ NodeGroup.inputs.new('NodeSocketFloat','Cloud Brightness')
+
+ NodeGroup.links.new(group_inputs.outputs['Density'],MathGreaterThan.inputs[0])
+ NodeGroup.links.new(group_inputs.outputs['Absorption Multiply'],MathAbsorptionMultiply.inputs[1])
+ NodeGroup.links.new(group_inputs.outputs['Absorption Color'],MathBrightnessMultiply.inputs[0])
+ NodeGroup.links.new(group_inputs.outputs['Scatter Multiply'],MathScatterMultiply.inputs[1])
+ NodeGroup.links.new(group_inputs.outputs['Scatter Color'],VolumeScatter.inputs[0])
+ NodeGroup.links.new(group_inputs.outputs['Emission Amount'],MathEmissionMultiply.inputs[1])
+ NodeGroup.links.new(group_inputs.outputs['Cloud Brightness'],MathBrightnessMultiply.inputs[1])
+
+
if Type == 'CloudGen_TextureProperties':
MathAdd = NodeGroup.nodes.new('ShaderNodeMath')
MathAdd.location = [-200,0]
@@ -149,30 +149,30 @@ def CreateNodeGroup(Type):
NoiseTex.inputs['Detail'].default_value = 4
TexCoord = NodeGroup.nodes.new('ShaderNodeTexCoord')
TexCoord.location = [-1250,0]
-
-
+
+
NodeGroup.links.new(MathAdd.inputs[0],MathDensityMultiply.outputs[0])
NodeGroup.links.new(MathAdd.inputs[1],PointDensityRamp.outputs[0])
NodeGroup.links.new(MathDensityMultiply.inputs[0],CloudRamp.outputs[0])
NodeGroup.links.new(CloudRamp.inputs[0],NoiseTex.outputs[0])
NodeGroup.links.new(NoiseTex.inputs[0],TexCoord.outputs[3])
-
+
# Create and Link In/Out to Group Nodes
# Outputs
group_outputs = NodeGroup.nodes.new('NodeGroupOutput')
group_outputs.location = (0,0)
- NodeGroup.outputs.new('NodeSocketFloat','Density W_CloudTex')
- NodeGroup.links.new(MathAdd.outputs[0],group_outputs.inputs['Density W_CloudTex'])
-
+ NodeGroup.outputs.new('NodeSocketFloat','Density W_CloudTex')
+ NodeGroup.links.new(MathAdd.outputs[0],group_outputs.inputs['Density W_CloudTex'])
+
# Inputs
group_inputs = NodeGroup.nodes.new('NodeGroupInput')
group_inputs.location = (-1250,-300)
- NodeGroup.inputs.new('NodeSocketFloat','Scale')
- NodeGroup.inputs.new('NodeSocketFloat','Point Density In')
- NodeGroup.links.new(group_inputs.outputs['Scale'],NoiseTex.inputs['Scale'])
- NodeGroup.links.new(group_inputs.outputs['Point Density In'],MathDensityMultiply.inputs[1])
- NodeGroup.links.new(group_inputs.outputs['Point Density In'],PointDensityRamp.inputs[0])
-
+ NodeGroup.inputs.new('NodeSocketFloat','Scale')
+ NodeGroup.inputs.new('NodeSocketFloat','Point Density In')
+ NodeGroup.links.new(group_inputs.outputs['Scale'],NoiseTex.inputs['Scale'])
+ NodeGroup.links.new(group_inputs.outputs['Point Density In'],MathDensityMultiply.inputs[1])
+ NodeGroup.links.new(group_inputs.outputs['Point Density In'],PointDensityRamp.inputs[0])
+
return NodeGroup
# This routine takes an object and deletes all of the geometry in it
@@ -512,8 +512,8 @@ class GenerateCloud(Operator):
# Parameters the user may want to change:
# Number of points this number is multiplied by the volume to get
# the number of points the scripts will put in the volume.
-
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
numOfPoints = 1.0
maxNumOfPoints = 100000
maxPointDensityRadius = 1.5
@@ -528,17 +528,17 @@ class GenerateCloud(Operator):
pointDensityRadiusFactor = .37
densityScale = 1.5
noiseScale = 1
-
-
+
+
# What should we do?
WhatToDo = getActionToDo(active_object)
if WhatToDo == 'DEGENERATE':
# Degenerate Cloud
mainObj = active_object
-
+
bpy.ops.object.hide_view_clear()
-
+
cloudMembers = active_object.children
createdObjects = []
@@ -714,9 +714,9 @@ class GenerateCloud(Operator):
# Set time
scene.frame_current = 1
-
+
#Set Up Material for Blender Internal
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
# Set Up the Cloud Material
cloudMaterial.name = "CloudMaterial"
cloudMaterial.type = 'VOLUME'
@@ -766,64 +766,64 @@ class GenerateCloud(Operator):
bpy.ops.texture.slot_move(type='UP')
#Set Up Material for Cycles Engine
- elif bpy.context.scene.render.engine == 'CYCLES':
+ elif bpy.context.scene.render.engine == 'CYCLES':
VolumePropertiesGroup = CreateNodeGroup('CloudGen_VolumeProperties')
CloudTexPropertiesGroup = CreateNodeGroup('CloudGen_TextureProperties')
-
+
cloudMaterial.name = "CloudMaterial"
# Add a texture
# vMaterialTextureSlots = cloudMaterial.texture_slots # UNUSED
cloudtex = blend_data.textures.new("CloudTex", type='CLOUDS')
cloudtex.noise_type = 'HARD_NOISE'
- cloudtex.noise_scale = 2
-
+ cloudtex.noise_scale = 2
+
cloudMaterial.use_nodes = True
cloudTree = cloudMaterial.node_tree
cloudMatNodes = cloudTree.nodes
cloudMatNodes.clear()
-
- outputNode = cloudMatNodes.new('ShaderNodeOutputMaterial')
+
+ outputNode = cloudMatNodes.new('ShaderNodeOutputMaterial')
outputNode.location = (200,300)
-
- tranparentNode = cloudMatNodes.new('ShaderNodeBsdfTransparent')
- tranparentNode.location = (0,300)
-
- volumeGroup = cloudMatNodes.new("ShaderNodeGroup")
+
+ tranparentNode = cloudMatNodes.new('ShaderNodeBsdfTransparent')
+ tranparentNode.location = (0,300)
+
+ volumeGroup = cloudMatNodes.new("ShaderNodeGroup")
volumeGroup.node_tree = VolumePropertiesGroup
volumeGroup.location = (0,150)
-
- cloudTexGroup = cloudMatNodes.new("ShaderNodeGroup")
+
+ cloudTexGroup = cloudMatNodes.new("ShaderNodeGroup")
cloudTexGroup.node_tree = CloudTexPropertiesGroup
cloudTexGroup.location = (-200,150)
-
- PointDensityNode = cloudMatNodes.new("ShaderNodeTexPointDensity")
+
+ PointDensityNode = cloudMatNodes.new("ShaderNodeTexPointDensity")
PointDensityNode.location = (-400,150)
PointDensityNode.resolution = 100
PointDensityNode.space = 'OBJECT'
- PointDensityNode.interpolation = 'Linear'
+ PointDensityNode.interpolation = 'Linear'
# PointDensityNode.color_source = 'CONSTANT'
-
+
cloudTree.links.new(outputNode.inputs[0],tranparentNode.outputs[0])
cloudTree.links.new(outputNode.inputs[1],volumeGroup.outputs[0])
cloudTree.links.new(volumeGroup.inputs[0],cloudTexGroup.outputs[0])
cloudTree.links.new(cloudTexGroup.inputs[1],PointDensityNode.outputs[1])
-
+
#PointDensityNode.point_source = 'PARTICLE_SYSTEM'
#VolumePropsNode = cloudMatNodes.new(VolumePropertiesGroup)
#VolumePropsNode.location = (-200,0)
-
-
+
+
#tree = bpy.data.materials['CloudMaterial'].node_tree
#group = bpy.data.groups.data.node_groups['CloudGen_VolumeProperties']
#newgroup = tree.nodes.new("ShaderNodeGroup")
#newgroup.node_tree = bpy.data.node_groups['CloudGen_VolumeProperties']
- #ramp = tree.nodes.new('ShaderNodeValToRGB')
+ #ramp = tree.nodes.new('ShaderNodeValToRGB')
#cramp = ramp.color_ramp
-
+
#mport bpy
#obj = bpy.data.objects['CloudBounds']
#(obj.dimensions[0] * obj.dimensions[1] * obj.dimensions[2])
-
+
# Estimate the number of particles for the size of bounds.
volumeBoundBox = (bounds.dimensions[0] * bounds.dimensions[1] * bounds.dimensions[2])
numParticles = int((2.4462 * volumeBoundBox + 430.4) * numOfPoints)
@@ -838,14 +838,14 @@ class GenerateCloud(Operator):
cloudParticles.settings.count = numParticles
PDensityRadius = (.00013764 * volumeBoundBox + .3989) * pointDensityRadiusFactor
-
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
pDensity.point_density.radius = PDensityRadius
if pDensity.point_density.radius > maxPointDensityRadius:
pDensity.point_density.radius = maxPointDensityRadius
-
- elif bpy.context.scene.render.engine == 'CYCLES':
+
+ elif bpy.context.scene.render.engine == 'CYCLES':
PointDensityNode.radius = PDensityRadius
if PDensityRadius > maxPointDensityRadius:
@@ -879,28 +879,28 @@ class GenerateCloud(Operator):
# Apply modifier
bpy.ops.object.modifier_apply(apply_as='DATA', modifier=cldPntsModifiers[0].name)
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
pDensity.point_density.point_source = 'OBJECT'
pDensity.point_density.object = cloudPnts
- elif bpy.context.scene.render.engine == 'CYCLES':
+ elif bpy.context.scene.render.engine == 'CYCLES':
PointDensityNode.point_source = 'OBJECT'
PointDensityNode.object = cloudPnts
-
+
removeParticleSystemFromObj(scene, cloud)
else:
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
pDensity.point_density.point_source = 'PARTICLE_SYSTEM'
pDensity.point_density.object = cloud
pDensity.point_density.particle_system = cloudParticles
- elif bpy.context.scene.render.engine == 'CYCLES':
+ elif bpy.context.scene.render.engine == 'CYCLES':
PointDensityNode.point_source = 'PARTICLE_SYSTEM'
PointDensityNode.particle_system = cloudPnts
-
- if bpy.context.scene.render.engine == 'BLENDER_RENDER':
+
+ if bpy.context.scene.render.engine == 'BLENDER_RENDER':
if scene.cloud_type == '1': # Cumulous
print("Cumulous")
mVolume.density_scale = 2.22
@@ -932,33 +932,33 @@ class GenerateCloud(Operator):
pRampElement3 = pRampElements.new(0.669)
pRampElement3.color = 0.0, 0.0, 0.040, 1
-
+
elif bpy.context.scene.render.engine == 'CYCLES':
-
- volumeGroup.inputs['Absorption Multiply'].default_value = 50
- volumeGroup.inputs['Absorption Color'].default_value = (1.0, 1.0, 1.0, 1.0)
- volumeGroup.inputs['Scatter Multiply'].default_value = 30
- volumeGroup.inputs['Scatter Color'].default_value = (.58, .58, .58, 1.0)
- volumeGroup.inputs['Emission Amount'].default_value = .1
+
+ volumeGroup.inputs['Absorption Multiply'].default_value = 50
+ volumeGroup.inputs['Absorption Color'].default_value = (1.0, 1.0, 1.0, 1.0)
+ volumeGroup.inputs['Scatter Multiply'].default_value = 30
+ volumeGroup.inputs['Scatter Color'].default_value = (.58, .58, .58, 1.0)
+ volumeGroup.inputs['Emission Amount'].default_value = .1
volumeGroup.inputs['Cloud Brightness'].default_value = 1.3
noiseCloudScale = volumeBoundBox*(-.001973)+5.1216
if noiseCloudScale < .05:
- noiseCloudScale = .05
+ noiseCloudScale = .05
cloudTexGroup.inputs['Scale'].default_value = noiseCloudScale
-
+
if scene.cloud_type == '1': # Cumulous
print("Cumulous")
-
+
elif scene.cloud_type == '2': # Cirrus
print("Cirrus")
-
+
elif scene.cloud_type == '3': # Explosion
print("Explosion")
-
+
#to cloud to view in cycles in render mode we need to hide geometry meshes...
- firstObject.hide = True
- cloud.hide = True
-
+ firstObject.hide = True
+ cloud.hide = True
+
# Select the object.
bounds.select = True
scene.objects.active = bounds
diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py
index fe78429f..ad4cdf39 100644
--- a/object_fracture_cell/__init__.py
+++ b/object_fracture_cell/__init__.py
@@ -77,7 +77,7 @@ def main_object(scene, obj, level, **kw):
if kw_copy["use_debug_redraw"]:
obj_draw_type_prev = obj.draw_type
obj.draw_type = 'WIRE'
-
+
objects = fracture_cell_setup.cell_fracture_objects(scene, obj, **kw_copy)
objects = fracture_cell_setup.cell_fracture_boolean(scene, obj, objects,
use_island_split=use_island_split,
@@ -229,8 +229,8 @@ def main(context, **kw):
return volume
return _getObjectVolume()
-
-
+
+
obj_volume_ls = [_get_volume(obj_cell) for obj_cell in objects]
obj_volume_tot = sum(obj_volume_ls)
if obj_volume_tot > 0.0:
@@ -381,7 +381,7 @@ class FractureCell(Operator):
# -------------------------------------------------------------------------
# Physics Options
-
+
mass_mode = EnumProperty(
name="Mass Mode",
items=(('VOLUME', "Volume", "Objects get part of specified mass based on their volume"),
@@ -389,7 +389,7 @@ class FractureCell(Operator):
),
default='VOLUME',
)
-
+
mass = FloatProperty(
name="Mass",
description="Mass to give created objects",
@@ -417,7 +417,7 @@ class FractureCell(Operator):
# Scene Options
#
# .. different from object options in that this controls how the objects
- # are setup in the scene.
+ # are setup in the scene.
use_layer_index = IntProperty(
name="Layer Index",
@@ -445,7 +445,7 @@ class FractureCell(Operator):
description="Create mesh data showing the points used for fracture",
default=False,
)
-
+
use_debug_redraw = BoolProperty(
name="Show Progress Realtime",
description="Redraw as fracture is done",
@@ -509,7 +509,7 @@ class FractureCell(Operator):
rowsub.prop(self, "material_index")
rowsub.prop(self, "use_interior_vgroup")
- # could be own section, control how we subdiv
+ # could be own section, control how we subdiv
rowsub.prop(self, "margin")
rowsub.prop(self, "use_island_split")
diff --git a/oscurart_tools/oscurart_meshes.py b/oscurart_tools/oscurart_meshes.py
index 67c9623f..595a0971 100644
--- a/oscurart_tools/oscurart_meshes.py
+++ b/oscurart_tools/oscurart_meshes.py
@@ -321,7 +321,7 @@ class OscObjectToMesh(Operator):
bl_label = "Object To Mesh"
bl_label = "Object To Mesh"
-
+
@classmethod
def poll(cls, context):
return (context.active_object is not None and
@@ -476,7 +476,7 @@ class ModalIndexOperator(Operator):
# -------------------------- SELECT DOUBLES
-def SelDoubles(self, context):
+def SelDoubles(self, context):
bm = bmesh.from_edit_mesh(bpy.context.object.data)
for v in bm.verts:
@@ -495,7 +495,7 @@ def SelDoubles(self, context):
bm.verts[v].select = 1
bpy.context.scene.objects.active = bpy.context.scene.objects.active
-
+
class SelectDoubles(Operator):
"""Selects duplicated vertex without merge them."""
@@ -512,4 +512,4 @@ class SelectDoubles(Operator):
def execute(self, context):
SelDoubles(self, context)
- return {'FINISHED'} \ No newline at end of file
+ return {'FINISHED'} \ No newline at end of file
diff --git a/oscurart_tools/oscurart_objects.py b/oscurart_tools/oscurart_objects.py
index 347999cd..dda2aa89 100644
--- a/oscurart_tools/oscurart_objects.py
+++ b/oscurart_tools/oscurart_objects.py
@@ -133,7 +133,7 @@ def relinkObjects(self):
if SCENE.objects:
if bpy.selection_osc[-1] in SCENE.objects[:]:
LISTSCENE.append(SCENE)
-
+
if LISTSCENE:
OBJECTS = bpy.selection_osc[:-1]
@@ -290,7 +290,7 @@ def ObjectDistributeOscurart(self, X, Y, Z):
class DialogDistributeOsc(Operator):
- """Distribute evenly the selected objects in x y z"""
+ """Distribute evenly the selected objects in x y z"""
bl_idname = "object.distribute_osc"
bl_label = "Distribute Objects"
Boolx = BoolProperty(name="X")
diff --git a/oscurart_tools/oscurart_render.py b/oscurart_tools/oscurart_render.py
index bdd42642..c3dbe8a9 100644
--- a/oscurart_tools/oscurart_render.py
+++ b/oscurart_tools/oscurart_render.py
@@ -435,7 +435,7 @@ class SumaFile(Operator):
class ClearFile(Operator):
- """Erase the list of broken frames."""
+ """Erase the list of broken frames."""
bl_idname = "object.clear_broken_file"
bl_label = "Clear Broken Files"
diff --git a/pie_menus_official/pie_clip_marker_of.py b/pie_menus_official/pie_clip_marker_of.py
index 32bee503..97c3a237 100644
--- a/pie_menus_official/pie_clip_marker_of.py
+++ b/pie_menus_official/pie_clip_marker_of.py
@@ -267,7 +267,7 @@ def register():
if wm.keyconfigs.addon:
#km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') # WHY
-
+
km = wm.keyconfigs.addon.keymaps.new(name="Clip", space_type='CLIP_EDITOR')
kmi = km.keymap_items.new("wm.call_menu_pie", 'Q', 'PRESS')
diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index bd7142f7..12f291a5 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -97,7 +97,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="Export scene path",
# Bug in POV-Ray RC3
# description="Path to directory where the exported scene "
- # "(POV and INI) is created",
+ # "(POV and INI) is created",
description="Path to directory where the files are created",
maxlen=1024, subtype="DIR_PATH")
renderimage_path = StringProperty(
@@ -116,12 +116,12 @@ class RenderPovSettingsScene(PropertyGroup):
name="Enable Radiosity",
description="Enable POV-Rays radiosity calculation",
default=False)
-
+
radio_display_advanced = BoolProperty(
name="Advanced Options",
description="Show advanced options",
default=False)
-
+
media_enable = BoolProperty(
name="Enable Media",
description="Enable POV-Rays atmospheric media",
@@ -136,7 +136,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="Media Color", description="The atmospheric media color",
precision=4, step=0.01, min=0, soft_max=1,
default=(0.001, 0.001, 0.001),
- options={'ANIMATABLE'},
+ options={'ANIMATABLE'},
subtype='COLOR')
baking_enable = BoolProperty(
@@ -182,7 +182,7 @@ class RenderPovSettingsScene(PropertyGroup):
("1", "recursive AA", "Type 2 Sampling in POV-Ray"),
("2", "stochastic AA", "Type 3 Sampling in UberPOV")),
default="1")
-
+
antialias_confidence = FloatProperty(
name="Antialias Confidence",
description="how surely the computed color "
@@ -220,8 +220,8 @@ class RenderPovSettingsScene(PropertyGroup):
description="Number of reflections/refractions allowed on ray "
"path",
min=1, max=256, default=5)
-
-#######NEW from Lanuhum
+
+#######NEW from Lanuhum
adc_bailout_enable = BoolProperty(
name="Enable",
description="",
@@ -310,7 +310,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="Count",
description="Photons count",
min=1, max=100000000, default=20000)
-
+
photon_spacing = FloatProperty(
name="Spacing",
description="Average distance between photons on surfaces. half "
@@ -339,7 +339,7 @@ class RenderPovSettingsScene(PropertyGroup):
photon_gather_max = IntProperty(
name="Gather Max", description="Maximum number of photons gathered for each point",
min=1, max=256, default=100)
-
+
photon_map_file_save_load = EnumProperty(
name="Operation",
description="Load or Save photon map file",
@@ -362,7 +362,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="File",
description="",
maxlen=1024, subtype="FILE_PATH")
-
+
radio_adc_bailout = FloatProperty(
name="ADC Bailout",
@@ -561,7 +561,7 @@ class RenderPovSettingsMaterial(PropertyGroup):
# NODES
-
+
def use_material_nodes_callback(self, context):
if hasattr(context.space_data, "tree_type"):
context.space_data.tree_type = 'ObjectNodeTree'
@@ -597,7 +597,7 @@ class RenderPovSettingsMaterial(PropertyGroup):
tmap.location = 0,200
links.new(tmap.outputs[0],output.inputs[0])
tmap.select = True
- tree.nodes.active = tmap
+ tree.nodes.active = tmap
else:
mat.use_nodes=False
@@ -656,12 +656,12 @@ class RenderPovSettingsMaterial(PropertyGroup):
object_preview_transform = BoolProperty(name="Transform object", description="",default=False)
object_preview_scale = FloatProperty(name="XYZ", min=0.5, max=2.0, default=1.0)
object_preview_rotate = FloatVectorProperty(name="Rotate", description="", min=-180.0, max=180.0,default=(0.0,0.0,0.0), subtype='XYZ')
- object_preview_bgcontrast = FloatProperty(name="Contrast", min=0.0, max=1.0, default=0.5)
-
-
+ object_preview_bgcontrast = FloatProperty(name="Contrast", min=0.0, max=1.0, default=0.5)
+
+
+###############################################################################
+# Povray Nodes
###############################################################################
-# Povray Nodes
-###############################################################################
class PovraySocketUniversal(bpy.types.NodeSocket):
bl_idname = 'PovraySocketUniversal'
bl_label = 'Povray Socket'
@@ -681,7 +681,7 @@ class PovraySocketUniversal(bpy.types.NodeSocket):
for link in links:
if link.from_node==node:
inps=link.to_node.inputs
- for inp in inps:
+ for inp in inps:
if inp.bl_idname=="PovraySocketFloat_0_1" and inp.is_linked:
prop="value_0_1"
if prop not in value:
@@ -995,7 +995,7 @@ node_categories = [
NodeItem("PovrayMirrorNode"),
NodeItem("PovrayIridescenceNode"),
NodeItem("PovraySubsurfaceNode"),
- ]),
+ ]),
PovrayShaderNodeCategory("CYCLES", "Cycles", items=[
NodeItem("ShaderNodeAddShader"),
@@ -1100,7 +1100,7 @@ node_categories = [
]),
]
############### end nodes
-
+
###############################################################################
# Texture POV properties.
###############################################################################
@@ -1126,7 +1126,7 @@ class RenderPovSettingsTexture(PropertyGroup):
# "it points at. pigment {} expected",
# default="")
-
+
tex_pattern_type = EnumProperty(
name="Texture_Type",
@@ -1140,7 +1140,7 @@ class RenderPovSettingsTexture(PropertyGroup):
('cells', 'Cells', '', 'PLUGIN', 6),
('crackle', 'Crackle', '', 'PLUGIN', 7),
('cubic', 'Cubic', '', 'PLUGIN', 8),
- ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9),
+ ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9),
('density_file', 'Density', '(.df3)', 'PLUGIN', 10),
('dents', 'Dents', '', 'PLUGIN', 11),
('fractal', 'Fractal', '', 'PLUGIN', 12),
@@ -1175,7 +1175,7 @@ class RenderPovSettingsTexture(PropertyGroup):
magnet_style = EnumProperty(
name="Magnet style",
description="magnet or julia",
- items=(('mandel', "Mandelbrot", ""),('julia', "Julia", "")),
+ items=(('mandel', "Mandelbrot", ""),('julia', "Julia", "")),
default='julia')
magnet_type = IntProperty(
@@ -1196,87 +1196,87 @@ class RenderPovSettingsTexture(PropertyGroup):
description="Select the orientation of warp",
items=(('x', "X", ""), ('y', "Y", ""), ('z', "Z", "")),
default='y')
-
+
wave_type = EnumProperty(
name="Waves type",
description="Select the type of waves",
items=(('ramp', "Ramp", ""), ('sine', "Sine", ""), ('scallop', "Scallop", ""),
('cubic', "Cubic", ""), ('poly', "Poly", ""), ('triangle', 'Triangle', "")),
- default='ramp')
+ default='ramp')
gen_noise = IntProperty(
name="Noise Generators",
description="Noise Generators",
- min=1, max=3, default=1)
+ min=1, max=3, default=1)
warp_dist_exp = FloatProperty(
name="Distance exponent",
description="Distance exponent",
min=0.0, max=100.0, default=1.0)
-
+
warp_tor_major_radius = FloatProperty(
name="Major radius",
description="Torus is distance from major radius",
- min=0.0, max=5.0, default=1.0)
+ min=0.0, max=5.0, default=1.0)
warp_turbulence_x = FloatProperty(
name="Turbulence X",
description="Turbulence X",
min=0.0, max=5.0, default=0.0)
-
+
warp_turbulence_y = FloatProperty(
name="Turbulence Y",
description="Turbulence Y",
- min=0.0, max=5.0, default=0.0)
+ min=0.0, max=5.0, default=0.0)
warp_turbulence_z = FloatProperty(
name="Turbulence Z",
description="Turbulence Z",
min=0.0, max=5.0, default=0.0)
-
+
modifier_octaves = IntProperty(
name="Turbulence octaves",
description="Turbulence octaves",
- min=1, max=10, default=1)
+ min=1, max=10, default=1)
modifier_lambda = FloatProperty(
name="Turbulence lambda",
description="Turbulence lambda",
min=0.0, max=5.0, default=1.00)
-
+
modifier_omega = FloatProperty(
name="Turbulence omega",
description="Turbulence omega",
- min=0.0, max=10.0, default=1.00)
+ min=0.0, max=10.0, default=1.00)
modifier_phase = FloatProperty(
name="Phase",
description="The phase value causes the map entries to be shifted so that the map "
"starts and ends at a different place",
min=0.0, max=2.0, default=0.0)
-
+
modifier_frequency = FloatProperty(
name="Frequency",
description="The frequency keyword adjusts the number of times that a color map "
"repeats over one cycle of a pattern",
- min=0.0, max=25.0, default=2.0)
+ min=0.0, max=25.0, default=2.0)
modifier_turbulence = FloatProperty(
name="Turbulence",
description="Turbulence",
- min=0.0, max=5.0, default=2.0)
-
+ min=0.0, max=5.0, default=2.0)
+
modifier_numbers = IntProperty(
name="Numbers",
description="Numbers",
- min=1, max=27, default=2)
+ min=1, max=27, default=2)
modifier_control0 = IntProperty(
name="Control0",
description="Control0",
min=0, max=100, default=1)
-
+
modifier_control1 = IntProperty(
name="Control1",
description="Control1",
@@ -1285,17 +1285,17 @@ class RenderPovSettingsTexture(PropertyGroup):
brick_size_x = FloatProperty(
name="Brick size x",
description="",
- min=0.0000, max=1.0000, default=0.2500)
+ min=0.0000, max=1.0000, default=0.2500)
brick_size_y = FloatProperty(
name="Brick size y",
description="",
min=0.0000, max=1.0000, default=0.0525)
-
+
brick_size_z = FloatProperty(
name="Brick size z",
description="",
- min=0.0000, max=1.0000, default=0.1250)
+ min=0.0000, max=1.0000, default=0.1250)
brick_mortar = FloatProperty(
name="Mortar",
@@ -1402,7 +1402,7 @@ class RenderPovSettingsTexture(PropertyGroup):
name="Pavement pattern 35",
description="maximum: 35",
min=1, max=35, default=35)
-
+
pave_tiles= IntProperty(
name="Pavement tiles",
description="If sides = 6, maximum tiles 5!!!",
@@ -1411,11 +1411,11 @@ class RenderPovSettingsTexture(PropertyGroup):
pave_form= IntProperty(
name="Pavement form",
description="",
- min=0, max=4, default=0)
-
+ min=0, max=4, default=0)
+
#########FUNCTIONS#############################################################################
#########FUNCTIONS#############################################################################
-
+
func_list = EnumProperty(
name="Functions",
description="Select the function for create pattern",
@@ -1425,20 +1425,20 @@ class RenderPovSettingsTexture(PropertyGroup):
("f_bicorn","Bicorn",""), ("f_bifolia","Bifolia",""),
("f_blob","Blob",""), ("f_blob2","Blob2",""),
("f_boy_surface","Boy surface",""), ("f_comma","Comma",""),
- ("f_cross_ellipsoids","Cross ellipsoids",""),
+ ("f_cross_ellipsoids","Cross ellipsoids",""),
("f_crossed_trough","Crossed trough",""), ("f_cubic_saddle","Cubic saddle",""),
("f_cushion","Cushion",""), ("f_devils_curve","Devils curve",""),
("f_devils_curve_2d","Devils curve 2d",""),
("f_dupin_cyclid","Dupin cyclid",""), ("f_ellipsoid","Ellipsoid",""),
("f_enneper","Enneper",""), ("f_flange_cover","Flange cover",""),
- ("f_folium_surface","Folium surface",""),
+ ("f_folium_surface","Folium surface",""),
("f_folium_surface_2d","Folium surface 2d",""), ("f_glob","Glob",""),
("f_heart","Heart",""), ("f_helical_torus","Helical torus",""),
("f_helix1","Helix1",""), ("f_helix2","Helix2",""), ("f_hex_x","Hex x",""),
("f_hex_y","Hex y",""), ("f_hetero_mf","Hetero mf",""),
("f_hunt_surface","Hunt surface",""),
("f_hyperbolic_torus","Hyperbolic torus",""),
- ("f_isect_ellipsoids","Isect ellipsoids",""),
+ ("f_isect_ellipsoids","Isect ellipsoids",""),
("f_kampyle_of_eudoxus","Kampyle of eudoxus",""),
("f_kampyle_of_eudoxus_2d","Kampyle of eudoxus 2d",""),
("f_klein_bottle","Klein bottle",""),
@@ -1467,7 +1467,7 @@ class RenderPovSettingsTexture(PropertyGroup):
("f_torus_gumdrop","Torus gumdrop",""), ("f_umbrella","Umbrella",""),
("f_witch_of_agnesi","Witch of agnesi",""),
("f_witch_of_agnesi_2d","Witch of agnesi 2d","")),
-
+
default='NONE')
func_x = FloatProperty(
@@ -1551,48 +1551,48 @@ class RenderPovSettingsTexture(PropertyGroup):
func_P9 = FloatProperty(
name="P9",
description="",
- min=0.0, max=25.0, default=1.0)
+ min=0.0, max=25.0, default=1.0)
#########################################
tex_rot_x = FloatProperty(
name="Rotate X",
description="",
- min=-180.0, max=180.0, default=0.0)
+ min=-180.0, max=180.0, default=0.0)
tex_rot_y = FloatProperty(
name="Rotate Y",
description="",
- min=-180.0, max=180.0, default=0.0)
+ min=-180.0, max=180.0, default=0.0)
tex_rot_z = FloatProperty(
name="Rotate Z",
description="",
- min=-180.0, max=180.0, default=0.0)
-
+ min=-180.0, max=180.0, default=0.0)
+
tex_mov_x = FloatProperty(
name="Move X",
description="",
- min=-100000.0, max=100000.0, default=0.0)
+ min=-100000.0, max=100000.0, default=0.0)
tex_mov_y = FloatProperty(
name="Move Y",
description="",
- min=-100000.0, max=100000.0, default=0.0)
+ min=-100000.0, max=100000.0, default=0.0)
tex_mov_z = FloatProperty(
name="Move Z",
description="",
- min=-100000.0, max=100000.0, default=0.0)
+ min=-100000.0, max=100000.0, default=0.0)
tex_scale_x = FloatProperty(
name="Scale X",
description="",
- min=0.0, max=10000.0, default=1.0)
+ min=0.0, max=10000.0, default=1.0)
tex_scale_y = FloatProperty(
name="Scale Y",
description="",
- min=0.0, max=10000.0, default=1.0)
+ min=0.0, max=10000.0, default=1.0)
tex_scale_z = FloatProperty(
name="Scale Z",
@@ -1639,19 +1639,19 @@ class RenderPovSettingsObject(PropertyGroup):
#############POV-Ray specific object properties.############################
object_as = StringProperty(maxlen=1024)
-
+
imported_loc = FloatVectorProperty(
name="Imported Pov location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 0.0))
-
+
imported_loc_cap = FloatVectorProperty(
name="Imported Pov location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 2.0))
unlock_parameters = BoolProperty(name="Lock",default = False)
-
+
curveshape = EnumProperty(
name="Povray Shape Type",
items=(("birail", "Birail", ""),
@@ -1661,7 +1661,7 @@ class RenderPovSettingsObject(PropertyGroup):
("prism", "Prism", ""),
("sphere_sweep", "Sphere Sweep", "")),
default="sphere_sweep")
-
+
mesh_write_as = EnumProperty(
name="Mesh Write As",
items=(("blobgrid", "Blob Grid", ""),
@@ -1672,7 +1672,7 @@ class RenderPovSettingsObject(PropertyGroup):
object_ior = FloatProperty(
name="IOR", description="IOR",
min=1.0, max=10.0,default=1.0)
-
+
# shape_as_light = StringProperty(name="Light",maxlen=1024)
# fake_caustics_power = FloatProperty(
# name="Power", description="Fake caustics power",
@@ -1690,23 +1690,23 @@ class RenderPovSettingsObject(PropertyGroup):
# reflection = BoolProperty(name="Reflection",description="",default=False)
# pass_through = BoolProperty(name="Pass through",description="",default=False)
no_shadow = BoolProperty(name="No Shadow",default=False)
-
+
no_image = BoolProperty(name="No Image",default=False)
-
+
no_reflection = BoolProperty(name="No Reflection",default=False)
-
+
no_radiosity = BoolProperty(name="No Radiosity",default=False)
-
+
inverse = BoolProperty(name="Inverse",default=False)
-
+
sturm = BoolProperty(name="Sturm",default=False)
-
+
double_illuminate = BoolProperty(name="Double Illuminate",default=False)
-
+
hierarchy = BoolProperty(name="Hierarchy",default=False)
-
+
hollow = BoolProperty(name="Hollow",default=False)
-
+
boundorclip = EnumProperty(
name="Boundorclip",
items=(("none", "None", ""),
@@ -1714,33 +1714,33 @@ class RenderPovSettingsObject(PropertyGroup):
("clipped_by", "Clipped_by", "")),
default="none")
boundorclipob = StringProperty(maxlen=1024)
-
+
addboundorclip = BoolProperty(description="",default=False)
-
+
blob_threshold = FloatProperty(name="Threshold",min=0.00, max=10.0, default=0.6)
blob_strength = FloatProperty(name="Strength",min=-10.00, max=10.0, default=1.00)
-
+
res_u = IntProperty(name="U",min=100, max=1000, default=500)
-
+
res_v = IntProperty(name="V",min=100, max=1000, default=500)
-
+
contained_by = EnumProperty(
name="Contained by",
items=(("box", "Box", ""),
("sphere", "Sphere", "")),
default="box")
-
+
container_scale = FloatProperty(name="Container Scale",min=0.0, max=10.0, default=1.00)
-
+
threshold = FloatProperty(name="Threshold",min=0.0, max=10.0, default=0.00)
-
+
accuracy = FloatProperty(name="Accuracy",min=0.0001, max=0.1, default=0.001)
-
+
max_gradient = FloatProperty(name="Max Gradient",min=0.0, max=100.0, default=5.0)
-
+
all_intersections = BoolProperty(name="All Intersections",default=False)
-
+
max_trace = IntProperty(name="Max Trace",min=1, max=100,default=1)
@@ -1756,12 +1756,12 @@ class RenderPovSettingsObject(PropertyGroup):
imported_cyl_loc = FloatVectorProperty(
name="Imported Pov location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 0.0))
-
+
imported_cyl_loc_cap = FloatVectorProperty(
name="Imported Pov location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 2.0))
def prop_update_sphere(self, context):
@@ -1778,7 +1778,7 @@ class RenderPovSettingsObject(PropertyGroup):
cone_cap_radius = FloatProperty(
name = "Cap radius", description = "The second radius of the cone",
default = 0.3, min = 0.0, max = 100.0, update=prop_update_cone)
-
+
cone_segments = IntProperty(
name = "Segments", description = "Radial segmentation of proxy mesh",
default = 16, min = 3, max = 265, update=prop_update_cone)
@@ -1788,12 +1788,12 @@ class RenderPovSettingsObject(PropertyGroup):
default = 2.0, min = 0.01, max = 100.0, update=prop_update_cone)
cone_base_z = FloatProperty()
- cone_cap_z = FloatProperty()
+ cone_cap_z = FloatProperty()
###########Parametric
def prop_update_parametric(self, context):
bpy.ops.pov.parametric_update()
-
+
u_min = FloatProperty(name = "U Min",
description = "",
default = 0.0, update=prop_update_parametric)
@@ -1817,7 +1817,7 @@ class RenderPovSettingsObject(PropertyGroup):
def prop_update_torus(self, context):
bpy.ops.pov.torus_update()
-
+
torus_major_segments = IntProperty(
name = "Segments", description = "Radial segmentation of proxy mesh",
default = 48, min = 3, max = 720, update=prop_update_torus)
@@ -1842,14 +1842,14 @@ class RenderPovSettingsObject(PropertyGroup):
description = "The angle after which rainbow dissolves into background",
default = 360, min = 0.0, max = 360)
-###########HeightFields
+###########HeightFields
quality = IntProperty(name = "Quality",
description = "",
default = 100, min = 1, max = 100)
-
+
hf_filename = StringProperty(maxlen = 1024)
-
+
hf_gamma = FloatProperty(
name="Gamma",
description="Gamma",
@@ -1874,7 +1874,7 @@ class RenderPovSettingsObject(PropertyGroup):
name="Hierarchy",
description="Height field hierarchy",
default=True)
-
+
##############Superellipsoid
def prop_update_superellipsoid(self, context):
bpy.ops.pov.superellipsoid_update()
@@ -1888,7 +1888,7 @@ class RenderPovSettingsObject(PropertyGroup):
name="Parameter 2",
description="",
min=0.00, max=10.0, default=0.04)
-
+
se_u = IntProperty(name = "U-segments",
description = "radial segmentation",
default = 20, min = 4, max = 265,
@@ -1923,11 +1923,11 @@ class RenderPovSettingsObject(PropertyGroup):
("sphere_sweep", "Sphere Sweep", ""),
("sor", "Surface of Revolution", "")),
default="sphere_sweep")
-
+
#############Supertorus
def prop_update_supertorus(self, context):
bpy.ops.pov.supertorus_update()
-
+
st_major_radius = FloatProperty(
name="Major radius",
description="Major radius",
@@ -1962,7 +1962,7 @@ class RenderPovSettingsObject(PropertyGroup):
description="Max gradient",
min=0.0001, max=100.00, default=10.00,
update=prop_update_supertorus)
-
+
st_R = FloatProperty(name = "big radius",
description = "The radius inside the tube",
default = 1.0, min = 0.01, max = 100.0,
@@ -2015,9 +2015,9 @@ class RenderPovSettingsObject(PropertyGroup):
default = 1, min = 0.01, max = 10)
loft_height = FloatProperty(name = "Height",
description = "Manipulates the shape of the Ring",
- default = 2, min = 0.01, max = 10.0)
+ default = 2, min = 0.01, max = 10.0)
-###################Prism
+###################Prism
prism_n = IntProperty(name = "Sides",
description = "Number of sides",
default = 5, min = 3, max = 720)
@@ -2027,7 +2027,7 @@ class RenderPovSettingsObject(PropertyGroup):
##################Isosurface
iso_function_text = StringProperty(name="Function Text",maxlen=1024)#,update=iso_props_update_callback)
-
+
##################PolygonToCircle
polytocircle_resolution = IntProperty(name = "Resolution",
description = "",
@@ -2044,12 +2044,12 @@ class RenderPovSettingsObject(PropertyGroup):
#################Avogadro
# filename_ext = ".png"
-
+
# filter_glob = StringProperty(
# default="*.exr;*.gif;*.hdr;*.iff;*.jpeg;*.jpg;*.pgm;*.png;*.pot;*.ppm;*.sys;*.tga;*.tiff;*.EXR;*.GIF;*.HDR;*.IFF;*.JPEG;*.JPG;*.PGM;*.PNG;*.POT;*.PPM;*.SYS;*.TGA;*.TIFF",
# options={'HIDDEN'},
# )
-
+
###############################################################################
# Camera POV properties.
###############################################################################
@@ -2094,19 +2094,19 @@ class RenderPovSettingsCamera(PropertyGroup):
normal_patterns = EnumProperty(
name="Pattern",
description="",
- items=(('agate', "Agate", ""), ('boxed', "Boxed", ""), ('bumps', "Bumps", ""), ('cells', "Cells", ""),
+ items=(('agate', "Agate", ""), ('boxed', "Boxed", ""), ('bumps', "Bumps", ""), ('cells', "Cells", ""),
('crackle', "Crackle", ""),('dents', "Dents", ""),
('granite', "Granite", ""),
('leopard', "Leopard", ""),
- ('marble', "Marble", ""), ('onion', "Onion", ""), ('pavement', "Pavement", ""), ('planar', "Planar", ""),
+ ('marble', "Marble", ""), ('onion', "Onion", ""), ('pavement', "Pavement", ""), ('planar', "Planar", ""),
('quilted', "Quilted", ""), ('ripples', "Ripples", ""), ('radial', "Radial", ""),
- ('spherical', "Spherical", ""),('spiral1', "Spiral1", ""), ('spiral2', "Spiral2", ""), ('spotted', "Spotted", ""),
+ ('spherical', "Spherical", ""),('spiral1', "Spiral1", ""), ('spiral2', "Spiral2", ""), ('spotted', "Spotted", ""),
('square', "Square", ""),('tiling', "Tiling", ""),
('waves', "Waves", ""), ('wood', "Wood", ""),('wrinkles', "Wrinkles", "")),
default='agate')
turbulence = FloatProperty(name="Turbulence", min=0.0, max=100.0, default=0.1)
scale = FloatProperty(name="Scale", min=0.0,default=1.0)
-
+
##################################CustomPOV Code############################
# Only DUMMIES below for now:
replacement_text = StringProperty(
@@ -2116,7 +2116,7 @@ class RenderPovSettingsCamera(PropertyGroup):
default="")
-
+
###############################################################################
# Text POV properties.
###############################################################################
@@ -2141,7 +2141,7 @@ class PovrayPreferences(AddonPreferences):
('uberpov', 'Unofficial UberPOV', '', 'PLUGIN', 1)),
default='povray'
)
-
+
filepath_povray = StringProperty(
name="Binary Location",
description="Path to renderer executable",
@@ -2161,7 +2161,7 @@ class PovrayPreferences(AddonPreferences):
-
+
def register():
bpy.utils.register_module(__name__)
@@ -2169,18 +2169,18 @@ def register():
bpy.types.INFO_MT_file_import.append(ui.menu_func_import)
#used for parametric objects:
addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True)
-
+
#bpy.types.TEXTURE_PT_context_texture.prepend(TEXTURE_PT_povray_type)
-
+
bpy.types.NODE_HT_header.append(ui.menu_func_nodes)
- nodeitems_utils.register_node_categories("POVRAYNODES", node_categories)
+ nodeitems_utils.register_node_categories("POVRAYNODES", node_categories)
bpy.types.Scene.pov = PointerProperty(type=RenderPovSettingsScene)
bpy.types.Material.pov = PointerProperty(type=RenderPovSettingsMaterial)
bpy.types.Texture.pov = PointerProperty(type=RenderPovSettingsTexture)
bpy.types.Object.pov = PointerProperty(type=RenderPovSettingsObject)
bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
bpy.types.Text.pov = PointerProperty(type=RenderPovSettingsText)
-
+
def unregister():
@@ -2192,7 +2192,7 @@ def unregister():
del bpy.types.Text.pov
nodeitems_utils.unregister_node_categories("POVRAYNODES")
bpy.types.NODE_HT_header.remove(ui.menu_func_nodes)
-
+
#bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type)
addon_utils.disable("add_mesh_extra_objects", default_set=False)
bpy.types.INFO_MT_file_import.remove(ui.menu_func_import)
diff --git a/render_povray/nodes.py b/render_povray/nodes.py
index 41b0caf1..bf6df14a 100644
--- a/render_povray/nodes.py
+++ b/render_povray/nodes.py
@@ -36,8 +36,8 @@ from bpy.props import (
-############### object
-
+############### object
+
class ObjectNodeTree(bpy.types.NodeTree):
'''Povray Material Nodes'''
@@ -305,7 +305,7 @@ class PovrayMappingNode(Node, ObjectNodeTree):
name="Distance exponent",
description="Distance exponent",
min=0.0, max=100.0, default=1.0)
-
+
warp_tor_major_radius = FloatProperty(
name="Major radius",
description="Torus is distance from major radius",
@@ -357,7 +357,7 @@ class PovrayMultiplyNode(Node, ObjectNodeTree):
name="Z",
description="Number of repeats",
min=1.0, max=10000.0, default=1.0)
-
+
def init(self, context):
self.outputs.new('NodeSocketVector', "Amount")
@@ -737,12 +737,12 @@ class ShaderPatternNode(Node, ObjectNodeTree):
spiral_arms = FloatProperty(
name="Number",
description="",
- min=0.0, max=256.0, default=2.0)
+ min=0.0, max=256.0, default=2.0)
tiling_number = IntProperty(
name="Number",
description="",
- min=1, max=27, default=1)
+ min=1, max=27, default=1)
gradient_orient = EnumProperty(
name="Orient",
@@ -750,7 +750,7 @@ class ShaderPatternNode(Node, ObjectNodeTree):
items=(('x', "X", ""),
('y', "Y", ""),
('z', "Z", "")),
- default='x')
+ default='x')
def init(self, context):
@@ -788,17 +788,17 @@ class ShaderTextureMapNode(Node, ObjectNodeTree):
brick_size_x = FloatProperty(
name="X",
description="",
- min=0.0000, max=1.0000, default=0.2500)
+ min=0.0000, max=1.0000, default=0.2500)
brick_size_y = FloatProperty(
name="Y",
description="",
min=0.0000, max=1.0000, default=0.0525)
-
+
brick_size_z = FloatProperty(
name="Z",
description="",
- min=0.0000, max=1.0000, default=0.1250)
+ min=0.0000, max=1.0000, default=0.1250)
brick_mortar = FloatProperty(
name="Mortar",
@@ -850,17 +850,17 @@ class ShaderNormalMapNode(Node, ObjectNodeTree):
brick_size_x = FloatProperty(
name="X",
description="",
- min=0.0000, max=1.0000, default=0.2500)
+ min=0.0000, max=1.0000, default=0.2500)
brick_size_y = FloatProperty(
name="Y",
description="",
min=0.0000, max=1.0000, default=0.0525)
-
+
brick_size_z = FloatProperty(
name="Z",
description="",
- min=0.0000, max=1.0000, default=0.1250)
+ min=0.0000, max=1.0000, default=0.1250)
brick_mortar = FloatProperty(
name="Mortar",
@@ -878,7 +878,7 @@ class ShaderNormalMapNode(Node, ObjectNodeTree):
def draw_buttons(self, context, layout):
#for i, inp in enumerate(self.inputs):
-
+
if self.inputs[0].default_value =='brick':
layout.prop(self, "brick_mortar")
layout.label("Brick size:")
@@ -1015,7 +1015,7 @@ class TextureOutputNode(Node, TextureNodeTree):
#################################Operators########################################
##################################################################################
-
+
class NODE_OT_iso_add(bpy.types.Operator):
bl_idname = "pov.nodeisoadd"
bl_label = "Create iso props"
@@ -1088,7 +1088,7 @@ class NODE_OT_povray_node_output_add(bpy.types.Operator):
def execute(self, context):
tree=bpy.context.object.active_material.node_tree
- tmap = tree.nodes.new('ShaderNodeOutputMaterial')
+ tmap = tree.nodes.new('ShaderNodeOutputMaterial')
bpy.context.object.active_material.node_tree.nodes.active=tmap
for inp in tmap.inputs:
tmap.inputs.remove(inp)
@@ -1249,7 +1249,7 @@ class PovrayPatternNode(bpy.types.Operator):
def invoke(self, context, event):
context.window_manager.modal_handler_add(self)
return {'RUNNING_MODAL'}
-
+
class UpdatePreviewMaterial(bpy.types.Operator):
'''Operator update preview material'''
bl_idname = "node.updatepreview"
@@ -1294,6 +1294,5 @@ class UpdatePreviewKey(bpy.types.Operator):
mapstr = "Node Editor"
map = conf.keymaps[mapstr]
map.keymap_items.new("node.updatepreview",type='RIGHTMOUSE',value="PRESS")
- return {'FINISHED'}
-
- \ No newline at end of file
+ return {'FINISHED'}
+
diff --git a/render_povray/primitives.py b/render_povray/primitives.py
index 1a9eea8a..f76a41ee 100644
--- a/render_povray/primitives.py
+++ b/render_povray/primitives.py
@@ -41,7 +41,7 @@ from bpy.props import (
from mathutils import (
Vector,
)
-
+
#import collections
def pov_define_mesh(mesh, verts, edges, faces, name, hide_geometry=True):
@@ -71,7 +71,7 @@ class POVRAY_OT_lathe_add(bpy.types.Operator):
rotation=(0, 0, 0), layers=layers)
ob=context.scene.objects.active
ob.name = ob.data.name = "PovLathe"
- ob.pov.object_as='LATHE'
+ ob.pov.object_as='LATHE'
bpy.ops.object.mode_set(mode='EDIT')
self.report({'INFO'}, "This native POV-Ray primitive "
"won't have any vertex to show in edit mode")
@@ -84,7 +84,7 @@ class POVRAY_OT_lathe_add(bpy.types.Operator):
return {'FINISHED'}
-
+
def pov_superellipsoid_define(context, op, ob):
if op:
@@ -97,7 +97,7 @@ def pov_superellipsoid_define(context, op, ob):
edit = op.se_edit
se_param1 = n2 # op.se_param1
se_param2 = n1 # op.se_param2
-
+
else:
assert(ob)
mesh = ob.data
@@ -109,10 +109,10 @@ def pov_superellipsoid_define(context, op, ob):
edit = ob.pov.se_edit
se_param1 = ob.pov.se_param1
se_param2 = ob.pov.se_param2
-
+
verts = []
r=1
-
+
stepSegment=360/v*pi/180
stepRing=pi/u
angSegment=0
@@ -142,9 +142,9 @@ def pov_superellipsoid_define(context, op, ob):
if edit == 'TRIANGLES':
verts.append((0,0,1))
verts.append((0,0,-1))
-
+
faces = []
-
+
for i in range(0,u-2):
m=i*v
for p in range(0,v):
@@ -192,17 +192,17 @@ def pov_superellipsoid_define(context, op, ob):
ob.pov.object_as = 'SUPERELLIPSOID'
ob.pov.se_param1 = n2
ob.pov.se_param2 = n1
-
+
ob.pov.se_u = u
ob.pov.se_v = v
- ob.pov.se_n1 = n1
+ ob.pov.se_n1 = n1
ob.pov.se_n2 = n2
- ob.pov.se_edit = edit
+ ob.pov.se_edit = edit
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
-
+
class POVRAY_OT_superellipsoid_add(bpy.types.Operator):
bl_idname = "pov.addsuperellipsoid"
bl_label = "Add SuperEllipsoid"
@@ -221,7 +221,7 @@ class POVRAY_OT_superellipsoid_add(bpy.types.Operator):
name="Parameter 2",
description="",
min=0.00, max=10.0, default=0.04)
-
+
se_u = IntProperty(name = "U-segments",
description = "radial segmentation",
default = 20, min = 4, max = 265)
@@ -245,11 +245,11 @@ class POVRAY_OT_superellipsoid_add(bpy.types.Operator):
def poll(cls, context):
engine = context.scene.render.engine
return (engine in cls.COMPAT_ENGINES)
-
+
def execute(self,context):
pov_superellipsoid_define(context, self, None)
- self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
+ self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
return {'FINISHED'}
@@ -328,7 +328,7 @@ def power(a,b):
if a < 0:
return -((-a)**b)
return a**b
-
+
def supertoroid(R,r,u,v,n1,n2):
a = 2*pi/u
b = 2*pi/v
@@ -348,7 +348,7 @@ def supertoroid(R,r,u,v,n1,n2):
faces.extend(f)
return verts, faces
-def pov_supertorus_define(context, op, ob):
+def pov_supertorus_define(context, op, ob):
if op:
mesh = None
st_R = op.st_R
@@ -371,7 +371,7 @@ def pov_supertorus_define(context, op, ob):
st_n2 = ob.pov.st_cross
st_ie = ob.pov.st_ie
st_edit = ob.pov.st_edit
-
+
if st_ie:
rad1 = (st_R+st_r)/2
rad2 = (st_R-st_r)/2
@@ -402,14 +402,14 @@ def pov_supertorus_define(context, op, ob):
ob.pov.st_cross = st_n2
ob.pov.st_ie = st_ie
ob.pov.st_edit = st_edit
-
+
class POVRAY_OT_supertorus_add(bpy.types.Operator):
bl_idname = "pov.addsupertorus"
bl_label = "Add Supertorus"
bl_description = "Create a SuperTorus"
bl_options = {'REGISTER', 'UNDO'}
- COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+ COMPAT_ENGINES = {'POVRAY_RENDER'}
+
st_R = FloatProperty(name = "big radius",
description = "The radius inside the tube",
default = 1.0, min = 0.01, max = 100.0)
@@ -434,7 +434,7 @@ class POVRAY_OT_supertorus_add(bpy.types.Operator):
st_edit = BoolProperty(name="",
description="",
default=False,
- options={'HIDDEN'})
+ options={'HIDDEN'})
@classmethod
def poll(cls, context):
@@ -444,8 +444,8 @@ class POVRAY_OT_supertorus_add(bpy.types.Operator):
def execute(self, context):
pov_supertorus_define(context, self, None)
- self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
- return {'FINISHED'}
+ self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
+ return {'FINISHED'}
class POVRAY_OT_supertorus_update(bpy.types.Operator):
bl_idname = "pov.supertorus_update"
@@ -477,7 +477,7 @@ class POVRAY_OT_loft_add(bpy.types.Operator):
bl_description = "Create a Curve data for Meshmaker"
bl_options = {'REGISTER', 'UNDO'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+
loft_n = IntProperty(name = "Segments",
description = "Vertical segments",
default = 16, min = 3, max = 720)
@@ -498,7 +498,7 @@ class POVRAY_OT_loft_add(bpy.types.Operator):
default = 2, min = 0.01, max = 10.0)
def execute(self,context):
-
+
props = self.properties
loftData = bpy.data.curves.new('Loft', type='CURVE')
loftData.dimensions = '3D'
@@ -605,7 +605,7 @@ class POVRAY_OT_plane_add(bpy.types.Operator):
bpy.ops.object.shade_smooth()
ob.pov.object_as = "PLANE"
return {'FINISHED'}
-
+
class POVRAY_OT_box_add(bpy.types.Operator):
bl_idname = "pov.addbox"
bl_label = "Box"
@@ -668,22 +668,22 @@ class POVRAY_OT_cylinder_add(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
# XXX Keep it in sync with __init__'s cylinder Primitive
- R = FloatProperty(name="Cylinder radius", min=0.00, max=10.0, default=1.0)
+ R = FloatProperty(name="Cylinder radius", min=0.00, max=10.0, default=1.0)
imported_cyl_loc = FloatVectorProperty(
name="Imported Pov base location",
- precision=6,
- default=(0.0, 0.0, 0.0))
+ precision=6,
+ default=(0.0, 0.0, 0.0))
imported_cyl_loc_cap = FloatVectorProperty(
name="Imported Pov cap location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 2.0))
def execute(self,context):
props = self.properties
R = props.R
- ob = context.object
+ ob = context.object
layers = 20*[False]
layers[0] = True
if ob:
@@ -699,7 +699,7 @@ class POVRAY_OT_cylinder_add(bpy.types.Operator):
LOC = props.imported_cyl_loc
LOC_CAP = props.imported_cyl_loc_cap
self.report({'INFO'}, "This native POV-Ray primitive "
- "won't have any vertex to show in edit mode")
+ "won't have any vertex to show in edit mode")
pov_cylinder_define(context, self, None, self.R, LOC, LOC_CAP)
@@ -743,7 +743,7 @@ def pov_sphere_define(context, op, ob, loc):
obrot = ob.rotation_euler
#obloc = ob.location
obscale = ob.scale
-
+
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.reveal()
bpy.ops.mesh.select_all(action='SELECT')
@@ -752,8 +752,8 @@ def pov_sphere_define(context, op, ob, loc):
#bpy.ops.transform.rotate(axis=obrot,constraint_orientation='GLOBAL')
bpy.ops.transform.resize(value=obscale)
#bpy.ops.transform.rotate(axis=obrot, proportional_size=1)
-
-
+
+
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
bpy.ops.object.shade_smooth()
@@ -776,35 +776,35 @@ class POVRAY_OT_sphere_add(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}
# XXX Keep it in sync with __init__'s torus Primitive
- R = FloatProperty(name="Sphere radius",min=0.00, max=10.0, default=0.5)
-
+ R = FloatProperty(name="Sphere radius",min=0.00, max=10.0, default=0.5)
+
imported_loc = FloatVectorProperty(
name="Imported Pov location",
- precision=6,
+ precision=6,
default=(0.0, 0.0, 0.0))
-
+
def execute(self,context):
props = self.properties
R = props.R
ob = context.object
-
-
-
+
+
+
if ob:
if ob.pov.imported_loc:
LOC = ob.pov.imported_loc
else:
if not props.imported_loc:
LOC = bpy.context.scene.cursor_location
-
+
else:
- LOC = props.imported_loc
+ LOC = props.imported_loc
self.report({'INFO'}, "This native POV-Ray primitive "
- "won't have any vertex to show in edit mode")
+ "won't have any vertex to show in edit mode")
pov_sphere_define(context, self, None, LOC)
return {'FINISHED'}
-
+
# def execute(self,context):
# layers = 20*[False]
# layers[0] = True
@@ -837,9 +837,9 @@ class POVRAY_OT_sphere_update(bpy.types.Operator):
pov_sphere_define(context, None, context.object,context.object.location)
- return {'FINISHED'}
+ return {'FINISHED'}
+
-
####################################CONE#######################################
def pov_cone_define(context, op, ob):
verts = []
@@ -856,7 +856,7 @@ def pov_cone_define(context, op, ob):
base = ob.pov.cone_base_radius
cap = ob.pov.cone_cap_radius
seg = ob.pov.cone_segments
- height = ob.pov.cone_height
+ height = ob.pov.cone_height
zc = height / 2
zb = -zc
@@ -931,7 +931,7 @@ class POVRAY_OT_cone_add(bpy.types.Operator):
def execute(self, context):
pov_cone_define(context, self, None)
- self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
+ self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode")
return {'FINISHED'}
@@ -1038,27 +1038,27 @@ class POVRAY_OT_blob_add(bpy.types.Operator):
ob = context.object
ob.name = "Blob"
return {'FINISHED'}
-
-class POVRAY_OT_rainbow_add(bpy.types.Operator):
+
+class POVRAY_OT_rainbow_add(bpy.types.Operator):
bl_idname = "pov.addrainbow"
bl_label = "Rainbow"
bl_description = "Add Rainbow"
bl_options = {'REGISTER', 'UNDO'}
-
+
def execute(self,context):
cam = context.scene.camera
- bpy.ops.object.lamp_add(type='SPOT', radius=1)
+ bpy.ops.object.lamp_add(type='SPOT', radius=1)
ob = context.object
ob.data.show_cone = False
ob.data.spot_blend = 0.5
- ob.data.shadow_buffer_clip_end = 0
+ ob.data.shadow_buffer_clip_end = 0
ob.data.shadow_buffer_clip_start = 4*cam.location.length
ob.data.distance = cam.location.length
- ob.data.energy = 0
+ ob.data.energy = 0
ob.name = ob.data.name = "PovRainbow"
ob.pov.object_as = "RAINBOW"
-
+
#obj = context.object
bpy.ops.object.constraint_add(type='DAMPED_TRACK')
@@ -1071,7 +1071,7 @@ class POVRAY_OT_rainbow_add(bpy.types.Operator):
#refocus on the actual rainbow
bpy.context.scene.objects.active = ob
ob.select=True
-
+
return {'FINISHED'}
class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
@@ -1079,10 +1079,10 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
bl_label = "Height Field"
bl_description = "Add Height Field "
bl_options = {'REGISTER', 'UNDO'}
-
+
# XXX Keep it in sync with __init__'s hf Primitive
# filename_ext = ".png"
-
+
# filter_glob = StringProperty(
# default="*.exr;*.gif;*.hdr;*.iff;*.jpeg;*.jpg;*.pgm;*.png;*.pot;*.ppm;*.sys;*.tga;*.tiff;*.EXR;*.GIF;*.HDR;*.IFF;*.JPEG;*.JPG;*.PGM;*.PNG;*.POT;*.PPM;*.SYS;*.TGA;*.TIFF",
# options={'HIDDEN'},
@@ -1091,7 +1091,7 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
description = "",
default = 100, min = 1, max = 100)
hf_filename = StringProperty(maxlen = 1024)
-
+
hf_gamma = FloatProperty(
name="Gamma",
description="Gamma",
@@ -1141,12 +1141,12 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.noise(factor=1)
bpy.ops.object.mode_set(mode="OBJECT")
-
- #needs a loop to select by index?
+
+ #needs a loop to select by index?
#bpy.ops.object.material_slot_remove()
#material just left there for now
-
-
+
+
mat.texture_slots.clear(-1)
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.hide(unselected=False)
@@ -1154,8 +1154,8 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper):
ob.pov.object_as = 'HEIGHT_FIELD'
ob.pov.hf_filename = impath
return {'FINISHED'}
-
-
+
+
############################TORUS############################################
def pov_torus_define(context, op, ob):
if op:
@@ -1169,21 +1169,21 @@ def pov_torus_define(context, op, ob):
mis = ob.pov.torus_minor_segments
mar = ob.pov.torus_major_radius
mir = ob.pov.torus_minor_radius
-
+
#keep object rotation and location for the add object operator
obrot = ob.rotation_euler
obloc = ob.location
-
+
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.reveal()
bpy.ops.mesh.select_all(action='SELECT')
bpy.ops.mesh.delete(type='VERT')
bpy.ops.mesh.primitive_torus_add(rotation = obrot, location = obloc, major_segments=mas, minor_segments=mis,major_radius=mar, minor_radius=mir)
-
+
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
-
+
if not ob:
bpy.ops.mesh.primitive_torus_add(major_segments=mas, minor_segments=mis,major_radius=mar, minor_radius=mir)
@@ -1197,13 +1197,13 @@ def pov_torus_define(context, op, ob):
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
-
+
class POVRAY_OT_torus_add(bpy.types.Operator):
bl_idname = "pov.addtorus"
bl_label = "Torus"
bl_description = "Add Torus"
bl_options = {'REGISTER', 'UNDO'}
-
+
# XXX Keep it in sync with __init__'s torus Primitive
mas = IntProperty(name = "Major Segments",
description = "",
@@ -1246,8 +1246,8 @@ class POVRAY_OT_torus_update(bpy.types.Operator):
pov_torus_define(context, None, context.object)
- return {'FINISHED'}
-
+ return {'FINISHED'}
+
###################################################################################
@@ -1256,7 +1256,7 @@ class POVRAY_OT_prism_add(bpy.types.Operator):
bl_label = "Prism"
bl_description = "Create Prism"
bl_options = {'REGISTER', 'UNDO'}
-
+
prism_n = IntProperty(name = "Sides",
description = "Number of sides",
default = 5, min = 3, max = 720)
@@ -1264,7 +1264,7 @@ class POVRAY_OT_prism_add(bpy.types.Operator):
description = "Radius",
default = 1.0)
def execute(self,context):
-
+
props = self.properties
loftData = bpy.data.curves.new('Prism', type='CURVE')
loftData.dimensions = '2D'
@@ -1296,9 +1296,9 @@ class POVRAY_OT_prism_add(bpy.types.Operator):
ob.pov.curveshape = "prism"
ob.name = ob.data.name = "Prism"
return {'FINISHED'}
-
+
##############################PARAMETRIC######################################
-def pov_parametric_define(context, op, ob):
+def pov_parametric_define(context, op, ob):
if op:
u_min = op.u_min
u_max = op.u_max
@@ -1317,7 +1317,7 @@ def pov_parametric_define(context, op, ob):
x_eq = ob.pov.x_eq
y_eq = ob.pov.y_eq
z_eq = ob.pov.z_eq
-
+
#keep object rotation and location for the updated object
obloc = ob.location
obrot = ob.rotation_euler # In radians
@@ -1325,7 +1325,7 @@ def pov_parametric_define(context, op, ob):
#in case cursor has moved
curloc = bpy.context.scene.cursor_location
-
+
bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.reveal()
bpy.ops.mesh.select_all(action='SELECT')
@@ -1335,7 +1335,7 @@ def pov_parametric_define(context, op, ob):
#extra work:
bpy.ops.transform.translate(value=(obloc-curloc), proportional_size=1)
bpy.ops.transform.rotate(axis=obrot, proportional_size=1)
-
+
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
@@ -1345,7 +1345,7 @@ def pov_parametric_define(context, op, ob):
ob = context.object
ob.name = ob.data.name = "PovParametric"
ob.pov.object_as = "PARAMETRIC"
-
+
ob.pov.u_min = u_min
ob.pov.u_max = u_max
ob.pov.v_min = v_min
@@ -1382,7 +1382,7 @@ class POVRAY_OT_parametric_add(bpy.types.Operator):
maxlen=1024, default = "sin(u)*sin(v/8)+cos(v/8)*1.5")
z_eq = StringProperty(
maxlen=1024, default = "sin(v)*(1+cos(u))*sin(v/8)")
-
+
def execute(self,context):
props = self.properties
u_min = props.u_min
@@ -1392,7 +1392,7 @@ class POVRAY_OT_parametric_add(bpy.types.Operator):
x_eq = props.x_eq
y_eq = props.y_eq
z_eq = props.z_eq
-
+
pov_parametric_define(context, self, None)
self.report({'INFO'}, "This native POV-Ray primitive "
"won't have any vertex to show in edit mode")
@@ -1423,7 +1423,7 @@ class POVRAY_OT_shape_polygon_to_circle_add(bpy.types.Operator):
bl_description = "Add Polygon To Circle Blending Surface"
bl_options = {'REGISTER', 'UNDO'}
COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+
# XXX Keep it in sync with __init__'s polytocircle properties
polytocircle_resolution = IntProperty(name = "Resolution",
description = "",
@@ -1471,9 +1471,9 @@ class POVRAY_OT_shape_polygon_to_circle_add(bpy.types.Operator):
bpy.ops.mesh.hide(unselected=False)
bpy.ops.object.mode_set(mode="OBJECT")
return {'FINISHED'}
-
+
#############################IMPORT
-
+
class ImportPOV(bpy.types.Operator, ImportHelper):
"""Load Povray files"""
bl_idname = "import_scene.pov"
@@ -1485,17 +1485,17 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
# File props.
files = CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'})
directory = StringProperty(maxlen=1024, subtype='FILE_PATH', options={'HIDDEN', 'SKIP_SAVE'})
-
+
filename_ext = {".pov",".inc"}
filter_glob = StringProperty(
default="*.pov;*.inc",
options={'HIDDEN'},
)
-
+
import_at_cur = BoolProperty(name="Import at Cursor Location",
description = "Ignore Object Matrix",
default=False)
-
+
def execute(self, context):
from mathutils import Matrix
verts = []
@@ -1517,7 +1517,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
cylinder_search = False
sphere_search = False
cone_search = False
- tex_search = False ##################
+ tex_search = False ##################
cache = []
matrixes = {}
writematrix = False
@@ -1529,30 +1529,30 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
r = g = b = 0.5
f = t = 0
color = None
-
+
for item, value in enumerate(cache):
-
+
if value == 'texture':
pass
-
+
if value == 'pigment':
-
+
if cache[item+2] in {'rgb','srgb'}:
pass
-
+
elif cache[item+2] in {'rgbf','srgbf'}:
pass
-
+
elif cache[item+2] in {'rgbt','srgbt'}:
try:
r,g,b,t = float(cache[item+3]),float(cache[item+4]),float(cache[item+5]),float(cache[item+6])
except:
r = g = b = t = float(cache[item+2])
color = (r,g,b,t)
-
+
elif cache[item+2] in {'rgbft','srgbft'}:
pass
-
+
else:
pass
@@ -1627,11 +1627,11 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
ob = context.object
ob.location = (x0,y0,z0)
#ob.scale = (r,r,r)
- mat_search(cache)
+ mat_search(cache)
except (ValueError):
pass
cache = []
- cone_search = False
+ cone_search = False
if word == 'plane':
plane_search = True
name_search = False
@@ -1641,11 +1641,11 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
try:
bpy.ops.pov.addplane()
ob = context.object
- mat_search(cache)
+ mat_search(cache)
except (ValueError):
pass
cache = []
- plane_search = False
+ plane_search = False
if word == 'box':
box_search = True
name_search = False
@@ -1665,12 +1665,12 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
bpy.ops.pov.addbox()
ob = context.object
ob.location = center
- mat_search(cache)
+ mat_search(cache)
except (ValueError):
pass
cache = []
- box_search = False
+ box_search = False
if word == 'cylinder':
cylinder_search = True
name_search = False
@@ -1689,28 +1689,28 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
r = float(cache[8])
-
+
vec = Vector(imported_cyl_loc_cap ) - Vector(imported_cyl_loc)
depth = vec.length
rot = Vector((0, 0, 1)).rotation_difference(vec) # Rotation from Z axis.
- trans = rot * Vector((0, 0, depth / 2)) # Such that origin is at center of the base of the cylinder.
+ trans = rot * Vector((0, 0, depth / 2)) # Such that origin is at center of the base of the cylinder.
#center = ((x0 + x1)/2,(y0 + y1)/2,(z0 + z1)/2)
scaleZ = sqrt((x1-x0)**2+(y1-y0)**2+(z1-z0)**2)/2
bpy.ops.pov.addcylinder(R=r, imported_cyl_loc=imported_cyl_loc, imported_cyl_loc_cap=imported_cyl_loc_cap)
ob = context.object
ob.location = (x0, y0, z0)
ob.rotation_euler = rot.to_euler()
- ob.scale = (1,1,scaleZ)
-
+ ob.scale = (1,1,scaleZ)
+
#scale data rather than obj?
# bpy.ops.object.mode_set(mode='EDIT')
# bpy.ops.mesh.reveal()
# bpy.ops.mesh.select_all(action='SELECT')
# bpy.ops.transform.resize(value=(1,1,scaleZ), constraint_orientation='LOCAL')
# bpy.ops.mesh.hide(unselected=False)
- # bpy.ops.object.mode_set(mode='OBJECT')
-
- mat_search(cache)
+ # bpy.ops.object.mode_set(mode='OBJECT')
+
+ mat_search(cache)
except (ValueError):
pass
@@ -1741,7 +1741,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
mat_search(cache)
cache = []
sphere_search = False
-##################End Primitives Import##################
+##################End Primitives Import##################
if word == '#declare':
name_search = True
if name_search:
@@ -1757,9 +1757,9 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
name_search = False
cache = []
if word == 'vertex_vectors':
- verts_search = True
+ verts_search = True
if verts_search:
- cache.append(word)
+ cache.append(word)
if word == '}':
verts_search = False
lenverts=cache[2]
@@ -1772,7 +1772,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
y=(i*3)+1
z=(i*3)+2
verts.append((float(cache[x]),float(cache[y]),float(cache[z])))
- cache = []
+ cache = []
#if word == 'face_indices':
#faces_search = True
if word == 'texture_list': ########
@@ -1784,7 +1784,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
tex_search = False ################
faces_search = True
if faces_search:
- cache.append(word)
+ cache.append(word)
if word == '}':
faces_search = False
lenfaces = cache[2]
@@ -1816,7 +1816,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
m2=i*6+5
materials.append((int(cache[m0]),int(cache[m1]),int(cache[m2])))
faces.append((int(cache[v0]),int(cache[v1]),int(cache[v2])))
- #mesh = pov_define_mesh(None, verts, [], faces, name, hide_geometry=False)
+ #mesh = pov_define_mesh(None, verts, [], faces, name, hide_geometry=False)
#ob_base = object_utils.object_data_add(context, mesh, operator=None)
#ob = ob_base.object
@@ -1830,7 +1830,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
for mName in povMats: #####################
if mName not in blendMats: ###########
povMat = bpy.data.materials.new(mName) #################
- mat_search(cache)
+ mat_search(cache)
ob.data.materials.append(bpy.data.materials[mName]) ###################
if materials: ##################
for i,val in enumerate(materials): ####################
@@ -1849,43 +1849,43 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
ob = bpy.context.object
matrix=ob.matrix_world
v=matrixes[name]
- matrix[0][0] = v[0]
- matrix[1][0] = v[1]
- matrix[2][0] = v[2]
- matrix[0][1] = v[3]
- matrix[1][1] = v[4]
- matrix[2][1] = v[5]
- matrix[0][2] = v[6]
- matrix[1][2] = v[7]
- matrix[2][2] = v[8]
- matrix[0][3] = v[9]
- matrix[1][3] = v[10]
- matrix[2][3] = v[11]
+ matrix[0][0] = v[0]
+ matrix[1][0] = v[1]
+ matrix[2][0] = v[2]
+ matrix[0][1] = v[3]
+ matrix[1][1] = v[4]
+ matrix[2][1] = v[5]
+ matrix[0][2] = v[6]
+ matrix[1][2] = v[7]
+ matrix[2][2] = v[8]
+ matrix[0][3] = v[9]
+ matrix[1][3] = v[10]
+ matrix[2][3] = v[11]
matrix = global_matrix*ob.matrix_world
ob.matrix_world = matrix
verts = []
faces = []
-
+
# if word == 'pigment':
# try:
# #all indices have been incremented once to fit a bad test file
# r,g,b,t = float(S[2]),float(S[3]),float(S[4]),float(S[5])
- # color = (r,g,b,t)
+ # color = (r,g,b,t)
# except (IndexError):
# #all indices have been incremented once to fit alternate test file
# r,g,b,t = float(S[3]),float(S[4]),float(S[5]),float(S[6])
- # color = (r,g,b,t)
+ # color = (r,g,b,t)
# except UnboundLocalError:
# # In case no transmit is specified ? put it to 0
# r,g,b,t = float(S[2]),float(S[3]),float(S[4],0)
# color = (r,g,b,t)
-
+
# except (ValueError):
# color = (0.8,0.8,0.8,0)
# pass
-
+
# if colors == [] or (colors != [] and color not in colors):
# colors.append(color)
# name = ob.name+"_mat"
@@ -1900,16 +1900,15 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
# else:
# for i in range(len(colors)):
# if color == colors[i]:
- # ob.data.materials.append(bpy.data.materials[matNames[i]])
-
- ##To keep Avogadro Camera angle:
+ # ob.data.materials.append(bpy.data.materials[matNames[i]])
+
+ ##To keep Avogadro Camera angle:
# for obj in bpy.context.scene.objects:
# if obj.type == "CAMERA":
# track = obj.constraints.new(type = "TRACK_TO")
# track.target = ob
# track.track_axis ="TRACK_NEGATIVE_Z"
# track.up_axis = "UP_Y"
- # obj.location = (0,0,0)
- return {'FINISHED'}
-
- \ No newline at end of file
+ # obj.location = (0,0,0)
+ return {'FINISHED'}
+
diff --git a/render_povray/render.py b/render_povray/render.py
index 1a98bdc5..384ed73f 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -54,9 +54,9 @@ def imageFormat(imgF):
}.get(os.path.splitext(imgF)[-1].upper(), "")
if not ext:
- #maybe add a check for if path exists here?
+ #maybe add a check for if path exists here?
print(" WARNING: texture image has no extension") #too verbose
-
+
ext = what(imgF) #imghdr is a python lib to identify image file types
return ext
@@ -66,7 +66,7 @@ def imgMap(ts):
if ts.mapping == 'FLAT':
image_map = "map_type 0 "
elif ts.mapping == 'SPHERE':
- image_map = "map_type 1 "
+ image_map = "map_type 1 "
elif ts.mapping == 'TUBE':
image_map = "map_type 2 "
@@ -106,7 +106,7 @@ def imgMapTransforms(ts):
1.0 / ts.scale.z,
0.5-(0.5/ts.scale.x) - (ts.offset.x),
0.5-(0.5/ts.scale.y) - (ts.offset.y),
- ts.offset.z))
+ ts.offset.z))
# image_map_transforms = (" translate <-0.5,-0.5,0.0> scale <%.4g,%.4g,%.4g> translate <%.4g,%.4g,%.4g>" % \
# ( 1.0 / ts.scale.x,
# 1.0 / ts.scale.y,
@@ -115,7 +115,7 @@ def imgMapTransforms(ts):
# (0.5 / ts.scale.y) + ts.offset.y,
# ts.offset.z))
# image_map_transforms = ("translate <-0.5,-0.5,0> scale <-1,-1,1> * <%.4g,%.4g,%.4g> translate <0.5,0.5,0> + <%.4g,%.4g,%.4g>" % \
- # (1.0 / ts.scale.x,
+ # (1.0 / ts.scale.x,
# 1.0 / ts.scale.y,
# 1.0 / ts.scale.z,
# ts.offset.x,
@@ -145,11 +145,11 @@ def imgMapBG(wts):
#if image_mapBG == "":
# print(" No background texture image found ")
return image_mapBG
-
-
+
+
def path_image(image):
return bpy.path.abspath(image.filepath, library=image.library).replace("\\","/")
- # .replace("\\","/") to get only forward slashes as it's what POV prefers,
+ # .replace("\\","/") to get only forward slashes as it's what POV prefers,
# even on windows
# end find image texture
# -----------------------------------------------------------------------------
@@ -211,16 +211,16 @@ def write_global_setting(scene,file):
file.write(" ambient_light <%.6f,%.6f,%.6f>\n"%scene.pov.ambient_light[:])
file.write(" irid_wavelength <%.6f,%.6f,%.6f>\n"%scene.pov.irid_wavelength[:])
file.write(" charset %s\n"%scene.pov.charset)
- file.write(" max_trace_level %s\n"%scene.pov.max_trace_level)
+ file.write(" max_trace_level %s\n"%scene.pov.max_trace_level)
file.write(" max_intersections %s\n"%scene.pov.max_intersections)
file.write(" number_of_waves %s\n"%scene.pov.number_of_waves)
- file.write(" noise_generator %s\n"%scene.pov.noise_generator)
+ file.write(" noise_generator %s\n"%scene.pov.noise_generator)
- # below properties not added to __init__ yet to avoid conflicts with material sss scale
+ # below properties not added to __init__ yet to avoid conflicts with material sss scale
# unless it would override then should be interfaced also in scene units property tab
# if scene.pov.sslt_enable:
- # file.write(" mm_per_unit %s\n"%scene.pov.mm_per_unit)
+ # file.write(" mm_per_unit %s\n"%scene.pov.mm_per_unit)
# file.write(" subsurface {\n")
# file.write(" samples %s, %s\n"%(scene.pov.sslt_samples_max,scene.pov.sslt_samples_min))
# if scene.pov.sslt_radiosity:
@@ -229,24 +229,24 @@ def write_global_setting(scene,file):
if scene.pov.radio_enable:
file.write(" radiosity {\n")
- file.write(" pretrace_start %.6f\n"%scene.pov.radio_pretrace_start)
- file.write(" pretrace_end %.6f\n"%scene.pov.radio_pretrace_end)
- file.write(" count %s\n"%scene.pov.radio_count)
- file.write(" nearest_count %s\n"%scene.pov.radio_nearest_count)
- file.write(" error_bound %.6f\n"%scene.pov.radio_error_bound)
- file.write(" recursion_limit %s\n"%scene.pov.radio_recursion_limit)
- file.write(" low_error_factor %.6f\n"%scene.pov.radio_low_error_factor)
- file.write(" gray_threshold %.6f\n"%scene.pov.radio_gray_threshold)
- file.write(" maximum_reuse %.6f\n"%scene.pov.radio_maximum_reuse)
- file.write(" minimum_reuse %.6f\n"%scene.pov.radio_minimum_reuse)
- file.write(" brightness %.6f\n"%scene.pov.radio_brightness)
+ file.write(" pretrace_start %.6f\n"%scene.pov.radio_pretrace_start)
+ file.write(" pretrace_end %.6f\n"%scene.pov.radio_pretrace_end)
+ file.write(" count %s\n"%scene.pov.radio_count)
+ file.write(" nearest_count %s\n"%scene.pov.radio_nearest_count)
+ file.write(" error_bound %.6f\n"%scene.pov.radio_error_bound)
+ file.write(" recursion_limit %s\n"%scene.pov.radio_recursion_limit)
+ file.write(" low_error_factor %.6f\n"%scene.pov.radio_low_error_factor)
+ file.write(" gray_threshold %.6f\n"%scene.pov.radio_gray_threshold)
+ file.write(" maximum_reuse %.6f\n"%scene.pov.radio_maximum_reuse)
+ file.write(" minimum_reuse %.6f\n"%scene.pov.radio_minimum_reuse)
+ file.write(" brightness %.6f\n"%scene.pov.radio_brightness)
file.write(" adc_bailout %.6f\n"%scene.pov.radio_adc_bailout)
if scene.pov.radio_normal:
- file.write(" normal on\n")
+ file.write(" normal on\n")
if scene.pov.radio_always_sample:
- file.write(" always_sample on\n")
+ file.write(" always_sample on\n")
if scene.pov.radio_media:
- file.write(" media on\n")
+ file.write(" media on\n")
if scene.pov.radio_subsurface:
file.write(" subsurface on\n")
file.write(" }\n")
@@ -321,10 +321,10 @@ def write_object_modifiers(scene,ob,File):
# File.write("ior %.4g\n"%ob.pov.object_ior)
# if scene.pov.photon_enable and ob.pov.target and ob.pov.refraction and ob.pov.dispersion:
# File.write("ior %.4g\n"%ob.pov.dispersion_value)
- # File.write("ior %s\n"%ob.pov.dispersion_samples)
+ # File.write("ior %s\n"%ob.pov.dispersion_samples)
# if scene.pov.photon_enable == False:
# File.write("caustics %.4g\n"%ob.pov.fake_caustics_power)
-
+
def write_pov(filename, scene=None, info_callback=None):
@@ -349,7 +349,7 @@ def write_pov(filename, scene=None, info_callback=None):
print("Unofficial UberPOV feature set chosen in preferences")
else:
print("Official POV-Ray 3.7 feature set chosen in preferences")
- if 'uber' in pov_binary:
+ if 'uber' in pov_binary:
print("The name of the binary suggests you are probably rendering with Uber POV engine")
else:
print("The name of the binary suggests you are probably rendering with standard POV engine")
@@ -488,7 +488,7 @@ def write_pov(filename, scene=None, info_callback=None):
materialNames = {}
DEF_MAT_NAME = "" #or "Default"?
-
+
def exportCamera():
camera = scene.camera
@@ -541,9 +541,9 @@ def write_pov(filename, scene=None, info_callback=None):
camera.data.pov.turbulence,
camera.data.pov.scale))
tabWrite("}\n")
-
-
+
+
def exportLamps(lamps):
# Incremented after each lamp export to declare its target
# currently used for Fresnel diffuse shader as their slope vector:
@@ -666,35 +666,35 @@ def write_pov(filename, scene=None, info_callback=None):
povdataname = ob.data.name #enough?
angle = degrees(ob.data.spot_size/2.5) #radians in blender (2
width = ob.data.spot_blend *10
- distance = ob.data.shadow_buffer_clip_start
+ distance = ob.data.shadow_buffer_clip_start
#eps=0.0000001
#angle = br/(cr+eps) * 10 #eps is small epsilon variable to avoid dividing by zero
#width = ob.dimensions[2] #now let's say width of rainbow is the actual proxy height
# formerly:
#cz-bz # let's say width of the rainbow is height of the cone (interfacing choice
-
+
# v(A,B) rotates vector A about origin by vector B.
# and avoid a 0 length vector by adding 1
-
+
# file.write("#declare %s_Target= vrotate(<%.6g,%.6g,%.6g>,<%.4g,%.4g,%.4g>);\n" % \
# (povdataname, -(ob.location.x+0.1), -(ob.location.y+0.1), -(ob.location.z+0.1),
- # ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z))
-
+ # ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z))
+
direction = (ob.location.x,ob.location.y,ob.location.z) # not taking matrix into account
rmatrix = global_matrix * ob.matrix_world
-
+
#ob.rotation_euler.to_matrix().to_4x4() * mathutils.Vector((0,0,1))
# XXX Is result of the below offset by 90 degrees?
- up =ob.matrix_world.to_3x3()[1].xyz #* global_matrix
+ up =ob.matrix_world.to_3x3()[1].xyz #* global_matrix
- # XXX TO CHANGE:
+ # XXX TO CHANGE:
#formerly:
- #tabWrite("#declare %s = rainbow {\n"%povdataname)
-
+ #tabWrite("#declare %s = rainbow {\n"%povdataname)
+
# clumsy for now but remove the rainbow from instancing
# system because not an object. use lamps later instead of meshes
-
+
#del data_ref[dataname]
tabWrite("rainbow {\n")
@@ -716,8 +716,8 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("[0.900 color rgbt<1.0, 0.2, 0.2, 0.7>]\n")
tabWrite("[1.000 color rgbt<1.0, 0.2, 0.2, 1.0>]\n")
tabWrite("}\n")
-
-
+
+
povMatName = "Default_texture"
#tabWrite("texture {%s}\n"%povMatName)
write_object_modifiers(scene,ob,file)
@@ -726,7 +726,7 @@ def write_pov(filename, scene=None, info_callback=None):
#writeMatrix(matrix)
tabWrite("}\n")
#continue #Don't render proxy mesh, skip to next object
-
+
################################XXX LOFT, ETC.
def exportCurves(scene, ob):
name_orig = "OB" + ob.name
@@ -1092,7 +1092,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write(' #break\n')
file.write(' #end\n')
file.write(' }\n')
-
+
file.write(' #debug concat(" - uv_vectors\\n") \n')
file.write(' #local NumVertices=dimension_size(UVArr,1);\n')
file.write(' #switch(Write)\n')
@@ -1264,7 +1264,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write(' #end\n')
file.write(' }\n')
file.write('#end\n')
-
+
file.write('#macro MSM(SplineArray, SplRes, Interp_type, InterpRes, FileName)\n')
file.write(' #declare Build=CheckFileName(FileName);\n')
file.write(' #if(Build=0)\n')
@@ -1425,7 +1425,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write(' BuildWriteMesh2(VecArr, NormArr, UVArr, Iter_U, Iter_V, FileName)\n')
file.write(' #end\n')
file.write('#end\n\n')
-
+
if bezier_sweep == False:
tabWrite("#declare %s =\n"%dataname)
if ob.pov.curveshape == 'sphere_sweep' and bezier_sweep == False:
@@ -1454,7 +1454,7 @@ def write_pov(filename, scene=None, info_callback=None):
wpt = endPt.co
tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], endPt.radius*ob.data.bevel_depth))
-
+
tabWrite("}\n")
if ob.pov.curveshape == 'sor':
@@ -1543,7 +1543,7 @@ def write_pov(filename, scene=None, info_callback=None):
r0 = points[i].radius * depth
r1 = 2/3*r0 + 1/3*r3
r2 = 1/3*r0 + 2/3*r3
- br.append((r0,r1,r2,r3))
+ br.append((r0,r1,r2,r3))
line="<%.4g,%.4g,%.4f>"%(p1[0],p1[1],p1[2])
line+="<%.4g,%.4g,%.4f>"%(pR[0],pR[1],pR[2])
line+="<%.4g,%.4g,%.4f>"%(pL[0],pL[1],pL[2])
@@ -1556,11 +1556,11 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("}\n")
if len(ob.data.splines)== 1:
tabWrite('#declare %s = object{\n'%dataname)
- tabWrite(' Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s) \n'%(ob.data.resolution_u,dataname,p,dataname,p))
+ tabWrite(' Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s) \n'%(ob.data.resolution_u,dataname,p,dataname,p))
else:
tabWrite('#declare %s = union{\n'%dataname)
for p in range(len(ob.data.splines)):
- tabWrite(' object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s)} \n'%(ob.data.resolution_u,dataname,p,dataname,p))
+ tabWrite(' object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s)} \n'%(ob.data.resolution_u,dataname,p,dataname,p))
#tabWrite('#include "bezier_spheresweep.inc"\n') #now inlined
# tabWrite('#declare %s = object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_bezier_points, %.4f) \n'%(dataname,ob.data.resolution_u,dataname,ob.data.bevel_depth))
if ob.pov.curveshape in {'loft'}:
@@ -1581,10 +1581,10 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("rotate <90,0,0>\n")
tabWrite("scale y*-1\n" )
tabWrite("}\n")
-
-#################################################################
-
-
+
+#################################################################
+
+
def exportMeta(metas):
# TODO - blenders 'motherball' naming is not supported.
@@ -1746,8 +1746,8 @@ def write_pov(filename, scene=None, info_callback=None):
# Data not yet processed, create a new entry in data_ref.
data_ref[dataname] = [(name, MatrixAsPovString(matrix))]
return dataname
-
-
+
+
def exportSmoke(smoke_obj_name):
#if LuxManager.CurrentScene.name == 'preview':
#return 1, 1, 1, 1.0
@@ -1927,12 +1927,12 @@ def write_pov(filename, scene=None, info_callback=None):
file.write("}\n")
-
+
#file.write(" interpolate 1\n")
#file.write(" frequency 0\n")
#file.write(" }\n")
- #file.write("}\n")
-
+ #file.write("}\n")
+
ob_num = 0
for ob in sel:
ob_num += 1
@@ -1949,7 +1949,7 @@ def write_pov(filename, scene=None, info_callback=None):
if (mod.smoke_type == 'DOMAIN'):
exportSmoke(ob.name)
break # don't render domain mesh or flow emitter mesh, skip to next object.
- if not smokeFlag:
+ if not smokeFlag:
# Export Hair
renderEmitter = True
if hasattr(ob, 'particle_systems'):
@@ -1971,7 +1971,7 @@ def write_pov(filename, scene=None, info_callback=None):
if pmaterial.strand.use_blender_units:
strandStart = pmaterial.strand.root_size
strandEnd = pmaterial.strand.tip_size
- strandShape = pmaterial.strand.shape
+ strandShape = pmaterial.strand.shape
else: # Blender unit conversion
strandStart = pmaterial.strand.root_size / 200.0
strandEnd = pmaterial.strand.tip_size / 200.0
@@ -1981,11 +1981,11 @@ def write_pov(filename, scene=None, info_callback=None):
strandStart = 0.01
strandEnd = 0.01
strandShape = 0.0
- # Set the number of particles to render count rather than 3d view display
- pSys.set_resolution(scene, ob, 'RENDER')
+ # Set the number of particles to render count rather than 3d view display
+ pSys.set_resolution(scene, ob, 'RENDER')
steps = pSys.settings.draw_step
steps = 3 ** steps # or (power of 2 rather than 3) + 1 # Formerly : len(particle.hair_keys)
-
+
totalNumberOfHairs = ( len(pSys.particles) + len(pSys.child_particles) )
#hairCounter = 0
file.write('#declare HairArray = array[%i] {\n' % totalNumberOfHairs)
@@ -1995,7 +1995,7 @@ def write_pov(filename, scene=None, info_callback=None):
#hairCounter += 1
#controlPointCounter = 0
# Each hair is represented as a separate sphere_sweep in POV-Ray.
-
+
file.write('sphere_sweep{')
if pSys.settings.use_hair_bspline:
file.write('b_spline ')
@@ -2003,7 +2003,7 @@ def write_pov(filename, scene=None, info_callback=None):
else:
file.write('linear_spline ')
file.write('%i,\n' % (steps))
- #changing world coordinates to object local coordinates by multiplying with inverted matrix
+ #changing world coordinates to object local coordinates by multiplying with inverted matrix
initCo = ob.matrix_world.inverted()*(pSys.co_hair(ob, pindex, 0))
if ob.material_slots[pSys.settings.material - 1].material and ob.active_material is not None:
pmaterial = ob.material_slots[pSys.settings.material-1].material
@@ -2023,7 +2023,7 @@ def write_pov(filename, scene=None, info_callback=None):
g = image_pixels[pixelnumber*4+1]
b = image_pixels[pixelnumber*4+2]
a = image_pixels[pixelnumber*4+3]
- initColor=(r,g,b,a)
+ initColor=(r,g,b,a)
else:
#only overwrite variable for each competing texture for now
initColor=th.texture.evaluate((initCo[0],initCo[1],initCo[2]))
@@ -2039,12 +2039,12 @@ def write_pov(filename, scene=None, info_callback=None):
if step == 0 and pSys.settings.use_hair_bspline:
# Write three times the first point to compensate pov Bezier handling
file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter)))
- file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter)))
+ file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter)))
#file.write('<%.6g,%.6g,%.6g>,%.7g' % (particle.location[0], particle.location[1], particle.location[2], abs(hDiameter))) # Useless because particle location is the tip, not the root.
#file.write(',\n')
#controlPointCounter += 1
#totalNumberOfHairs += len(pSys.particles)# len(particle.hair_keys)
-
+
# Each control point is written out, along with the radius of the
# hair at that point.
file.write('<%.6g,%.6g,%.6g>,%.7g' % (co[0], co[1], co[2], abs(hDiameter)))
@@ -2059,7 +2059,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write('\npigment{ color rgbf < %.3g, %.3g, %.3g, %.3g> }\n' %(initColor[0], initColor[1], initColor[2], 1.0-initColor[3]))
# End the sphere_sweep declaration for this hair
file.write('}\n')
-
+
# All but the final sphere_sweep (each array element) needs a terminating comma.
if pindex != totalNumberOfHairs:
file.write(',\n')
@@ -2070,7 +2070,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write('}\n')
file.write('\n')
-
+
if not texturedHair:
# Pick up the hair material diffuse color and create a default POV-Ray hair texture.
@@ -2113,20 +2113,20 @@ def write_pov(filename, scene=None, info_callback=None):
file.write(' }\n')
file.write(' }\n')
file.write(' }\n')
-
+
file.write(' #local I = I + HairStep;\n')
file.write(' #end\n')
-
+
writeMatrix(global_matrix * ob.matrix_world)
-
+
file.write('}')
print('Totals hairstrands written: %i' % totalNumberOfHairs)
print('Number of tufts (particle systems)', len(ob.particle_systems))
-
+
# Set back the displayed number of particles to preview count
pSys.set_resolution(scene, ob, 'PREVIEW')
-
+
if renderEmitter == False:
continue #don't render mesh, skip to next object.
@@ -2147,7 +2147,7 @@ def write_pov(filename, scene=None, info_callback=None):
ob.dupli_list_create(scene)
for eachduplicate in ob.dupli_list:
dataname_orig = "DATA" + eachduplicate.object.name
- ob.dupli_list_clear()
+ ob.dupli_list_clear()
elif ob.type == 'EMPTY':
name_orig = "OB" + ob.name
dataname_orig = "DATA" + ob.name
@@ -2176,13 +2176,13 @@ def write_pov(filename, scene=None, info_callback=None):
continue
print("Writing Down First Occurence of " + name)
-
+
############################################Povray Primitives
# special exportCurves() function takes care of writing
# lathe, sphere_sweep, birail, and loft except with modifiers
# converted to mesh
if not ob.is_modified(scene, 'RENDER'):
- if ob.type == 'CURVE' and (ob.pov.curveshape in
+ if ob.type == 'CURVE' and (ob.pov.curveshape in
{'lathe', 'sphere_sweep', 'loft'}):
continue #Don't render proxy mesh, skip to next object
@@ -2286,7 +2286,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("rotate x*90\n")
tabWrite("}\n")
continue #Don't render proxy mesh, skip to next object
-
+
if ob.pov.object_as == 'PLANE':
tabWrite("#declare %s = plane{ <0,0,1>,1\n"%povdataname)
@@ -2297,7 +2297,7 @@ def write_pov(filename, scene=None, info_callback=None):
material = ob.active_material
writeObjectMaterial(material, ob)
except IndexError:
- print(me)
+ print(me)
#tabWrite("texture {%s}\n"%povMatName)
write_object_modifiers(scene,ob,file)
#tabWrite("rotate x*90\n")
@@ -2433,7 +2433,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("}\n")
continue #Don't render proxy mesh, skip to next object
-
+
if ob.pov.object_as == 'PARAMETRIC':
tabWrite("#declare %s = parametric {\n"%povdataname)
tabWrite("function { %s }\n"%ob.pov.x_eq)
@@ -2449,7 +2449,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("precompute 10 x,y,z\n")
tabWrite("}\n")
continue #Don't render proxy mesh, skip to next object
-
+
if ob.pov.object_as == 'POLYCIRCLE':
#TODO write below macro Once:
#if write_polytocircle_macro_once == 0:
@@ -2541,23 +2541,23 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("}\n")
continue #Don't render proxy mesh, skip to next object
-
+
############################################else try to export mesh
elif ob.is_duplicator == False: #except duplis which should be instances groups for now but all duplis later
if ob.type == 'EMPTY':
tabWrite("\n//dummy sphere to represent Empty location\n")
tabWrite("#declare %s =sphere {<0, 0, 0>,0 pigment{rgbt 1} no_image no_reflection no_radiosity photons{pass_through collect off} hollow}\n" % povdataname)
-
+
try:
me = ob.to_mesh(scene, True, 'RENDER')
-
+
#XXX Here? identify the specific exception for mesh object with no data
#XXX So that we can write something for the dataname !
except:
# also happens when curves cant be made into meshes because of no-data
continue
-
+
importance = ob.pov.importance_value
if me:
me_materials = me.materials
@@ -2565,8 +2565,8 @@ def write_pov(filename, scene=None, info_callback=None):
if len(me_faces)==0:
tabWrite("\n//dummy sphere to represent empty mesh location\n")
tabWrite("#declare %s =sphere {<0, 0, 0>,0 pigment{rgbt 1} no_image no_reflection no_radiosity photons{pass_through collect off} hollow}\n" % povdataname)
-
-
+
+
if not me or not me_faces:
continue
@@ -2693,7 +2693,7 @@ def write_pov(filename, scene=None, info_callback=None):
except:
material = None
if material: #and material.use_vertex_color_paint: #Always use vertex color when there is some for now
-
+
col = vcol_layer[fi]
if len(faces_verts[fi]) == 4:
@@ -2724,7 +2724,7 @@ def write_pov(filename, scene=None, info_callback=None):
material_index
vertCols[key] = [-1]
- tabWrite("\n}\n")
+ tabWrite("\n}\n")
# Face indices
tabWrite("\nface_indices {\n")
tabWrite("%d" % (len(me_faces) + quadCount)) # faces count
@@ -2780,7 +2780,7 @@ def write_pov(filename, scene=None, info_callback=None):
if linebreaksinlists:
file.write(",\n")
file.write(tabStr + "<%d,%d,%d>, %d,%d,%d" % \
- (fv[i1], fv[i2], fv[i3], ci1-1, ci2-1, ci3-1)) # vert count
+ (fv[i1], fv[i2], fv[i3], ci1-1, ci2-1, ci3-1)) # vert count
else:
file.write(", ")
file.write("<%d,%d,%d>, %d,%d,%d" % \
@@ -2894,7 +2894,7 @@ def write_pov(filename, scene=None, info_callback=None):
vertCols[key] = [-1]
idx = 0
- LocalMaterialNames = []
+ LocalMaterialNames = []
for col, index in vertCols.items():
#if me_materials:
mater = me_materials[col[3]]
@@ -2903,7 +2903,7 @@ def write_pov(filename, scene=None, info_callback=None):
trans = 0.0
else:
- shading.writeTextureInfluence(mater, materialNames,
+ shading.writeTextureInfluence(mater, materialNames,
LocalMaterialNames,
path_image, lampCount,
imageFormat, imgMap,
@@ -2913,13 +2913,13 @@ def write_pov(filename, scene=None, info_callback=None):
safety, col, os, preview_dir, unpacked_images)
###################################################################
index[0] = idx
- idx += 1
+ idx += 1
+
-
# Vert Colors
tabWrite("texture_list {\n")
- # In case there's is no material slot, give at least one texture
+ # In case there's is no material slot, give at least one texture
#(an empty one so it uses pov default)
if len(vertCols)==0:
file.write(tabStr + "1")
@@ -2928,13 +2928,13 @@ def write_pov(filename, scene=None, info_callback=None):
-
- # below "material" alias, added check ob.active_material
- # to avoid variable referenced before assignment error
+
+ # below "material" alias, added check ob.active_material
+ # to avoid variable referenced before assignment error
try:
material = ob.active_material
except IndexError:
- #when no material slot exists,
+ #when no material slot exists,
material=None
# WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -2948,7 +2948,7 @@ def write_pov(filename, scene=None, info_callback=None):
for cMN in LocalMaterialNames:
if material != "Default":
file.write("\n texture{MAT_%s}\n" % cMN)
- #use string_strip_hyphen(materialNames[material]))
+ #use string_strip_hyphen(materialNames[material]))
#or Something like that to clean up the above?
elif material and material.pov.material_use_nodes:
for index in facesMaterials:
@@ -2956,7 +2956,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write("\n texture{%s}\n" % faceMaterial)
# END!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
else:
- file.write(" texture{}\n")
+ file.write(" texture{}\n")
tabWrite("}\n")
# Face indices
@@ -3113,8 +3113,8 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("}\n") # End of mesh block
-
-
+
+
bpy.data.meshes.remove(me)
duplidata_ref = []
@@ -3126,7 +3126,7 @@ def write_pov(filename, scene=None, info_callback=None):
dup = ""
if ob.is_modified(scene, 'RENDER'):
#modified object always unique so using object name rather than data name
- dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
+ dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
else:
dup = "#declare DATA%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name)))
for eachduplicate in ob.dupli_list:
@@ -3212,14 +3212,14 @@ def write_pov(filename, scene=None, info_callback=None):
# inverse, a standard scale factor.
# 0.5 Offset is needed relatively to scale because center of the
# UV scale is 0.5,0.5 in blender and 0,0 in POV
- # Further Scale by 2 and translate by -1 are
+ # Further Scale by 2 and translate by -1 are
# required for the sky_sphere not to repeat
-
+
mappingBlend = "scale 2 scale <%.4g,%.4g,%.4g> translate -1 " \
"translate <%.4g,%.4g,%.4g> rotate<0,0,0> " % \
- ((1.0 / t_blend.scale.x),
+ ((1.0 / t_blend.scale.x),
(1.0 / t_blend.scale.y),
- (1.0 / t_blend.scale.z),
+ (1.0 / t_blend.scale.z),
0.5-(0.5/t_blend.scale.x)- t_blend.offset.x,
0.5-(0.5/t_blend.scale.y)- t_blend.offset.y,
t_blend.offset.z)
@@ -3319,7 +3319,7 @@ def write_pov(filename, scene=None, info_callback=None):
if scene.pov.number_of_waves_enable:
file.write(" number_of_waves %s\n"%scene.pov.number_of_waves)
if scene.pov.noise_generator_enable:
- file.write(" noise_generator %s\n"%scene.pov.noise_generator)
+ file.write(" noise_generator %s\n"%scene.pov.noise_generator)
if scene.pov.radio_enable:
tabWrite("radiosity {\n")
tabWrite("adc_bailout %.4g\n" % scene.pov.radio_adc_bailout)
@@ -3328,7 +3328,7 @@ def write_pov(filename, scene=None, info_callback=None):
tabWrite("error_bound %.4g\n" % scene.pov.radio_error_bound)
tabWrite("gray_threshold %.4g\n" % scene.pov.radio_gray_threshold)
tabWrite("low_error_factor %.4g\n" % scene.pov.radio_low_error_factor)
- tabWrite("maximum_reuse %.4g\n" % scene.pov.radio_maximum_reuse)
+ tabWrite("maximum_reuse %.4g\n" % scene.pov.radio_maximum_reuse)
tabWrite("minimum_reuse %.4g\n" % scene.pov.radio_minimum_reuse)
tabWrite("nearest_count %d\n" % scene.pov.radio_nearest_count)
tabWrite("pretrace_start %.3g\n" % scene.pov.radio_pretrace_start)
@@ -3351,9 +3351,9 @@ def write_pov(filename, scene=None, info_callback=None):
# 1000 rather than scale * (-100.0) + 15.0))
# In POV-Ray, the scale factor for all subsurface shaders needs to be the same
-
+
# formerly sslt_samples were multiplied by 100 instead of 10
- sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 10
+ sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 10
tabWrite("subsurface { samples %d, %d }\n" % (sslt_samples, sslt_samples / 10))
onceSss = 0
@@ -3401,7 +3401,7 @@ def write_pov(filename, scene=None, info_callback=None):
exportGlobalSettings(scene)
-
+
if comments:
file.write("\n//--Custom Code--\n\n")
exportCustomCode()
@@ -3410,15 +3410,15 @@ def write_pov(filename, scene=None, info_callback=None):
file.write("\n//--Patterns Definitions--\n\n")
LocalPatternNames = []
for texture in bpy.data.textures: #ok?
- if texture.users > 0:
- currentPatName = string_strip_hyphen(bpy.path.clean_name(texture.name))
+ if texture.users > 0:
+ currentPatName = string_strip_hyphen(bpy.path.clean_name(texture.name))
#string_strip_hyphen(patternNames[texture.name]) #maybe instead of the above
- LocalPatternNames.append(currentPatName)
+ LocalPatternNames.append(currentPatName)
#use above list to prevent writing texture instances several times and assign in mats?
if (texture.type not in {'NONE', 'IMAGE'} and texture.pov.tex_pattern_type == 'emulator')or(texture.type in {'NONE', 'IMAGE'} and texture.pov.tex_pattern_type != 'emulator'):
file.write("\n#declare PAT_%s = \n" % currentPatName)
file.write(shading.exportPattern(texture, string_strip_hyphen))
- file.write("\n")
+ file.write("\n")
if comments:
file.write("\n//--Background--\n\n")
@@ -3433,7 +3433,7 @@ def write_pov(filename, scene=None, info_callback=None):
file.write("\n//--Lamps--\n\n")
exportLamps([L for L in sel if (L.type == 'LAMP' and L.pov.object_as != 'RAINBOW')])
-
+
if comments:
file.write("\n//--Rainbows--\n\n")
exportRainbows([L for L in sel if (L.type == 'LAMP' and L.pov.object_as == 'RAINBOW')])
@@ -3445,9 +3445,9 @@ def write_pov(filename, scene=None, info_callback=None):
if c.is_modified(scene, 'RENDER'):
continue #don't export as pov curves objects with modifiers, but as mesh
elif c.type == 'CURVE' and (c.pov.curveshape in {'lathe','sphere_sweep','loft','birail'}):
- exportCurves(scene,c)
+ exportCurves(scene,c)
+
-
if comments:
file.write("\n//--Material Definitions--\n\n")
# write a default pigment for objects with no material (comment out to show black)
@@ -3515,7 +3515,7 @@ def write_pov_ini(scene, filename_ini, filename_log, filename_pov, filename_imag
#file.write("All_File='%s'\n" % filename_log)
# DEBUG.OUT log if none specified:
file.write("All_File=1\n")
-
+
file.write("Input_File_Name='%s'\n" % filename_pov)
file.write("Output_File_Name='%s'\n" % filename_image)
@@ -3602,7 +3602,7 @@ class PovrayRender(bpy.types.RenderEngine):
pov_binary = os.path.join(win_home, "bin", "uberpov64.exe")
if os.path.exists(pov_binary):
return pov_binary
-
+
# Then try 64bits POV
pov_binary = os.path.join(win_home, "bin", "pvengine64.exe")
if os.path.exists(pov_binary):
@@ -3611,8 +3611,8 @@ class PovrayRender(bpy.types.RenderEngine):
# Then try 32bits UberPOV
pov_binary = os.path.join(win_home, "bin", "uberpov32.exe")
if os.path.exists(pov_binary):
- return pov_binary
-
+ return pov_binary
+
# Then try 32bits POV
pov_binary = os.path.join(win_home, "bin", "pvengine.exe")
if os.path.exists(pov_binary):
@@ -3997,8 +3997,8 @@ class PovrayRender(bpy.types.RenderEngine):
#print(filename_log) #bring the pov log to blender console with proper path?
with open(self._temp_file_log) as f: # The with keyword automatically closes the file when you are done
- print(f.read())
-
+ print(f.read())
+
self.update_stats("", "")
if scene.pov.tempfiles_enable or scene.pov.deletefiles_enable:
@@ -4070,7 +4070,7 @@ class RenderPovTexturePreview(Operator):
##################### end write ##########################################
pov_binary = PovrayRender._locate_binary()
-
+
if sys.platform[:3] == "win":
p1=subprocess.Popen(["%s"%pov_binary,"/EXIT","%s"%iniPrevFile],
stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
@@ -4084,19 +4084,19 @@ class RenderPovTexturePreview(Operator):
links = tree.links
for n in tree.nodes:
tree.nodes.remove(n)
- im = tree.nodes.new("TextureNodeImage")
+ im = tree.nodes.new("TextureNodeImage")
pathPrev="%s.png"%outputPrevFile
im.image = bpy.data.images.load(pathPrev)
name=pathPrev
name=name.split("/")
name=name[len(name)-1]
- im.name = name
+ im.name = name
im.location = 200,200
- previewer = tree.nodes.new('TextureNodeOutput')
+ previewer = tree.nodes.new('TextureNodeOutput')
previewer.label = "Preview"
previewer.location = 400,400
links.new(im.outputs[0],previewer.inputs[0])
#tex.type="IMAGE" # makes clip extend possible
#tex.extension="CLIP"
return {'FINISHED'}
-
+
diff --git a/render_povray/shading.py b/render_povray/shading.py
index 81fd2376..42dd2636 100644
--- a/render_povray/shading.py
+++ b/render_povray/shading.py
@@ -28,7 +28,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments
else:
tabWrite("\n")
tabWrite("#declare %s = finish {\n" % safety(name, Level=1))
-
+
elif Level == 2:
if comments:
tabWrite("//--translation of spec and mir levels for when no map " \
@@ -150,7 +150,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments
tabWrite("conserve_energy\n")
if colored_specular_found == True:
- tabWrite("metallic\n")
+ tabWrite("metallic\n")
# 'phong 70.0 '
if Level != 1:
@@ -158,7 +158,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments
raytrace_mirror = material.raytrace_mirror
if raytrace_mirror.reflect_factor:
tabWrite("reflection {\n")
- tabWrite("rgb <%.3g, %.3g, %.3g>\n" % material.mirror_color[:])
+ tabWrite("rgb <%.3g, %.3g, %.3g>\n" % material.mirror_color[:])
if material.pov.mirror_metallic:
tabWrite("metallic %.3g\n" % (raytrace_mirror.reflect_factor))
# Blurry reflections for UberPOV
@@ -173,7 +173,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments
tabWrite("fresnel 1 ")
tabWrite("falloff %.3g exponent %.3g} " % \
(raytrace_mirror.fresnel, raytrace_mirror.fresnel_factor))
-
+
if material.subsurface_scattering.use:
subsurface_scattering = material.subsurface_scattering
tabWrite("subsurface { translucency <%.3g, %.3g, %.3g> }\n" % (
@@ -241,7 +241,7 @@ def exportPattern(texture, string_strip_hyphen):
texStrg=""
def exportColorRamp(texture):
tex=texture
- pat = tex.pov
+ pat = tex.pov
colRampStrg="color_map {\n"
numColor=0
for el in tex.color_ramp.elements:
@@ -259,7 +259,7 @@ def exportPattern(texture, string_strip_hyphen):
colRampStrg+="color rgbf<%.4g,%.4g,%.4g,%.4g> \n"%(colR,colG,colB,colA)
if pat.tex_pattern_type == 'triangular' and numColor < 7 :
colRampStrg+="color rgbf<%.4g,%.4g,%.4g,%.4g> \n"%(colR,colG,colB,colA)
-
+
colRampStrg+="} \n"
#end color map
return colRampStrg
@@ -268,50 +268,50 @@ def exportPattern(texture, string_strip_hyphen):
if tex.type not in {'NONE', 'IMAGE'} and pat.tex_pattern_type == 'emulator':
texStrg+="pigment {\n"
####################### EMULATE BLENDER VORONOI TEXTURE ####################
- if tex.type == 'VORONOI':
+ if tex.type == 'VORONOI':
texStrg+="crackle\n"
texStrg+=" offset %.4g\n"%tex.nabla
texStrg+=" form <%.4g,%.4g,%.4g>\n"%(tex.weight_1, tex.weight_2, tex.weight_3)
if tex.distance_metric == 'DISTANCE':
- texStrg+=" metric 2.5\n"
+ texStrg+=" metric 2.5\n"
if tex.distance_metric == 'DISTANCE_SQUARED':
texStrg+=" metric 2.5\n"
- texStrg+=" poly_wave 2\n"
- if tex.distance_metric == 'MINKOVSKY':
- texStrg+=" metric %s\n"%tex.minkovsky_exponent
- if tex.distance_metric == 'MINKOVSKY_FOUR':
+ texStrg+=" poly_wave 2\n"
+ if tex.distance_metric == 'MINKOVSKY':
+ texStrg+=" metric %s\n"%tex.minkovsky_exponent
+ if tex.distance_metric == 'MINKOVSKY_FOUR':
texStrg+=" metric 4\n"
- if tex.distance_metric == 'MINKOVSKY_HALF':
+ if tex.distance_metric == 'MINKOVSKY_HALF':
texStrg+=" metric 0.5\n"
- if tex.distance_metric == 'CHEBYCHEV':
+ if tex.distance_metric == 'CHEBYCHEV':
texStrg+=" metric 10\n"
- if tex.distance_metric == 'MANHATTAN':
+ if tex.distance_metric == 'MANHATTAN':
texStrg+=" metric 1\n"
if tex.color_mode == 'POSITION':
texStrg+="solid\n"
- texStrg+="scale 0.25\n"
+ texStrg+="scale 0.25\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<0,0,0,1>]\n"
- texStrg+="[1 color rgbt<1,1,1,0>]\n"
- texStrg+="}\n"
+ texStrg+="[1 color rgbt<1,1,1,0>]\n"
+ texStrg+="}\n"
####################### EMULATE BLENDER CLOUDS TEXTURE ####################
- if tex.type == 'CLOUDS':
+ if tex.type == 'CLOUDS':
if tex.noise_type == 'SOFT_NOISE':
texStrg+="wrinkles\n"
texStrg+="scale 0.25\n"
else:
- texStrg+="granite\n"
+ texStrg+="granite\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<0,0,0,1>]\n"
- texStrg+="[1 color rgbt<1,1,1,0>]\n"
+ texStrg+="[1 color rgbt<1,1,1,0>]\n"
texStrg+="}\n"
####################### EMULATE BLENDER WOOD TEXTURE ####################
@@ -332,7 +332,7 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="scale 0.25\n"
texStrg+="rotate <45,-45,45>\n"
texStrg+="turbulence %.4g\n"%(tex.turbulence/10)
-
+
if tex.noise_basis_2 == 'SIN':
texStrg+="sine_wave\n"
if tex.noise_basis_2 == 'TRI':
@@ -344,11 +344,11 @@ def exportPattern(texture, string_strip_hyphen):
else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<0,0,0,0>]\n"
- texStrg+="[1 color rgbt<1,1,1,0>]\n"
+ texStrg+="[1 color rgbt<1,1,1,0>]\n"
texStrg+="}\n"
-
+
####################### EMULATE BLENDER STUCCI TEXTURE ####################
- if tex.type == 'STUCCI':
+ if tex.type == 'STUCCI':
texStrg+="bozo\n"
texStrg+="scale 0.25\n"
if tex.noise_type == 'HARD_NOISE':
@@ -368,9 +368,9 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="[0 color rgbf<0,0,0,1>]\n"
texStrg+="[1 color rgbt<1,1,1,0>]\n"
texStrg+="}\n"
-
+
####################### EMULATE BLENDER MAGIC TEXTURE ####################
- if tex.type == 'MAGIC':
+ if tex.type == 'MAGIC':
texStrg+="leopard\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
@@ -382,10 +382,10 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="[0.75 color rgbf<1,0,1,0.75>]\n"
texStrg+="[1 color rgbf<0,1,0,0.75>]\n"
texStrg+="}\n"
- texStrg+="scale 0.1\n"
-
+ texStrg+="scale 0.1\n"
+
####################### EMULATE BLENDER MARBLE TEXTURE ####################
- if tex.type == 'MARBLE':
+ if tex.type == 'MARBLE':
texStrg+="marble\n"
texStrg+="turbulence 0.5\n"
texStrg+="noise_generator 3\n"
@@ -408,7 +408,7 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="}\n"
else:
texStrg+="[0 color rgbt<0,0,0,0>]\n"
- texStrg+="[1 color rgbt<1,1,1,0>]\n"
+ texStrg+="[1 color rgbt<1,1,1,0>]\n"
texStrg+="}\n"
if tex.noise_basis_2 == 'SIN':
texStrg+="sine_wave\n"
@@ -416,7 +416,7 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="triangle_wave\n"
if tex.noise_basis_2 == 'SAW':
texStrg+="ramp_wave\n"
-
+
####################### EMULATE BLENDER BLEND TEXTURE ####################
if tex.type == 'BLEND':
if tex.progression=='RADIAL':
@@ -437,7 +437,7 @@ def exportPattern(texture, string_strip_hyphen):
elif tex.progression=='DIAGONAL':
texStrg+="gradient <1,1,0>\n"
texStrg+="scale 3\n"
- elif tex.use_flip_axis=='HORIZONTAL':
+ elif tex.use_flip_axis=='HORIZONTAL':
texStrg+="gradient x\n"
texStrg+="scale 2.01\n"
elif tex.use_flip_axis=='VERTICAL':
@@ -453,16 +453,16 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
texStrg+="}\n"
- if tex.progression == 'LINEAR':
+ if tex.progression == 'LINEAR':
texStrg+=" poly_wave 1\n"
- if tex.progression == 'QUADRATIC':
+ if tex.progression == 'QUADRATIC':
texStrg+=" poly_wave 2\n"
if tex.progression == 'EASING':
texStrg+=" poly_wave 1.5\n"
-
+
####################### EMULATE BLENDER MUSGRAVE TEXTURE ####################
- # if tex.type == 'MUSGRAVE':
+ # if tex.type == 'MUSGRAVE':
# texStrg+="function{ f_ridged_mf( x, y, 0, 1, 2, 9, -0.5, 3,3 )*0.5}\n"
# texStrg+="color_map {\n"
# texStrg+="[0 color rgbf<0,0,0,1>]\n"
@@ -474,17 +474,17 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="bozo scale 0.25 \n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {[0.5 color rgbf<0,0,0,1>][1 color rgbt<1,1,1,0>]}ramp_wave \n"
-
+
####################### EMULATE BLENDER DISTORTED NOISE TEXTURE ####################
- if tex.type == 'DISTORTED_NOISE':
+ if tex.type == 'DISTORTED_NOISE':
texStrg+="average\n"
texStrg+=" pigment_map {\n"
texStrg+=" [1 bozo scale 0.25 turbulence %.4g\n" %tex.distortion
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
@@ -495,37 +495,37 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+=" [1 cells scale 0.1\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
texStrg+="}\n"
- texStrg+="]\n"
+ texStrg+="]\n"
if tex.noise_distortion=='VORONOI_CRACKLE':
texStrg+=" [1 crackle scale 0.25\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
texStrg+="}\n"
- texStrg+="]\n"
+ texStrg+="]\n"
if tex.noise_distortion in ['VORONOI_F1','VORONOI_F2','VORONOI_F3','VORONOI_F4','VORONOI_F2_F1']:
texStrg+=" [1 crackle metric 2.5 scale 0.25 turbulence %.4g\n" %(tex.distortion/2)
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
texStrg+="}\n"
- texStrg+="]\n"
+ texStrg+="]\n"
else:
- texStrg+=" [1 wrinkles scale 0.25\n"
+ texStrg+=" [1 wrinkles scale 0.25\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0 color rgbt<1,1,1,0>]\n"
texStrg+="[1 color rgbf<0,0,0,1>]\n"
@@ -534,13 +534,13 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+=" }\n"
####################### EMULATE BLENDER NOISE TEXTURE ####################
- if tex.type == 'NOISE':
+ if tex.type == 'NOISE':
texStrg+="cells\n"
texStrg+="turbulence 3\n"
texStrg+="omega 3\n"
if tex.use_color_ramp == True:
texStrg+=exportColorRamp(tex)
- else:
+ else:
texStrg+="color_map {\n"
texStrg+="[0.75 color rgb<0,0,0,>]\n"
texStrg+="[1 color rgb<1,1,1,>]\n"
@@ -549,81 +549,81 @@ def exportPattern(texture, string_strip_hyphen):
####################### IGNORE OTHER BLENDER TEXTURE ####################
else: #non translated textures
pass
- texStrg+="}\n\n"
+ texStrg+="}\n\n"
texStrg+="#declare f%s=\n"%PATname
- texStrg+="function{pigment{%s}}\n"%PATname
+ texStrg+="function{pigment{%s}}\n"%PATname
texStrg+="\n"
-
+
elif pat.tex_pattern_type != 'emulator':
texStrg+="pigment {\n"
texStrg+="%s\n"%pat.tex_pattern_type
- if pat.tex_pattern_type == 'agate':
- texStrg+="agate_turb %.4g\n"%pat.modifier_turbulence
- if pat.tex_pattern_type in {'spiral1', 'spiral2', 'tiling'}:
+ if pat.tex_pattern_type == 'agate':
+ texStrg+="agate_turb %.4g\n"%pat.modifier_turbulence
+ if pat.tex_pattern_type in {'spiral1', 'spiral2', 'tiling'}:
texStrg+="%s\n"%pat.modifier_numbers
- if pat.tex_pattern_type == 'quilted':
- texStrg+="control0 %s control1 %s\n"%(pat.modifier_control0, pat.modifier_control1)
- if pat.tex_pattern_type == 'mandel':
- texStrg+="%s exponent %s \n"%(pat.f_iter, pat.f_exponent)
- if pat.tex_pattern_type == 'julia':
- texStrg+="<%.4g, %.4g> %s exponent %s \n"%(pat.julia_complex_1, pat.julia_complex_2, pat.f_iter, pat.f_exponent)
- if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'mandel':
+ if pat.tex_pattern_type == 'quilted':
+ texStrg+="control0 %s control1 %s\n"%(pat.modifier_control0, pat.modifier_control1)
+ if pat.tex_pattern_type == 'mandel':
+ texStrg+="%s exponent %s \n"%(pat.f_iter, pat.f_exponent)
+ if pat.tex_pattern_type == 'julia':
+ texStrg+="<%.4g, %.4g> %s exponent %s \n"%(pat.julia_complex_1, pat.julia_complex_2, pat.f_iter, pat.f_exponent)
+ if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'mandel':
texStrg+="%s mandel %s \n"%(pat.magnet_type, pat.f_iter)
- if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'julia':
- texStrg+="%s julia <%.4g, %.4g> %s\n"%(pat.magnet_type, pat.julia_complex_1, pat.julia_complex_2, pat.f_iter)
+ if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'julia':
+ texStrg+="%s julia <%.4g, %.4g> %s\n"%(pat.magnet_type, pat.julia_complex_1, pat.julia_complex_2, pat.f_iter)
if pat.tex_pattern_type in {'mandel', 'julia', 'magnet'}:
- texStrg+="interior %s, %.4g\n"%(pat.f_ior, pat.f_ior_fac)
+ texStrg+="interior %s, %.4g\n"%(pat.f_ior, pat.f_ior_fac)
texStrg+="exterior %s, %.4g\n"%(pat.f_eor, pat.f_eor_fac)
- if pat.tex_pattern_type == 'gradient':
+ if pat.tex_pattern_type == 'gradient':
texStrg+="<%s, %s, %s> \n"%(pat.grad_orient_x, pat.grad_orient_y, pat.grad_orient_z)
if pat.tex_pattern_type == 'pavement':
numTiles=pat.pave_tiles
numPattern=1
- if pat.pave_sides == '4' and pat.pave_tiles == 3:
+ if pat.pave_sides == '4' and pat.pave_tiles == 3:
numPattern = pat.pave_pat_2
- if pat.pave_sides == '6' and pat.pave_tiles == 3:
+ if pat.pave_sides == '6' and pat.pave_tiles == 3:
numPattern = pat.pave_pat_3
- if pat.pave_sides == '3' and pat.pave_tiles == 4:
+ if pat.pave_sides == '3' and pat.pave_tiles == 4:
numPattern = pat.pave_pat_3
- if pat.pave_sides == '3' and pat.pave_tiles == 5:
+ if pat.pave_sides == '3' and pat.pave_tiles == 5:
numPattern = pat.pave_pat_4
- if pat.pave_sides == '4' and pat.pave_tiles == 4:
+ if pat.pave_sides == '4' and pat.pave_tiles == 4:
numPattern = pat.pave_pat_5
- if pat.pave_sides == '6' and pat.pave_tiles == 4:
+ if pat.pave_sides == '6' and pat.pave_tiles == 4:
numPattern = pat.pave_pat_7
- if pat.pave_sides == '4' and pat.pave_tiles == 5:
+ if pat.pave_sides == '4' and pat.pave_tiles == 5:
numPattern = pat.pave_pat_12
- if pat.pave_sides == '3' and pat.pave_tiles == 6:
+ if pat.pave_sides == '3' and pat.pave_tiles == 6:
numPattern = pat.pave_pat_12
- if pat.pave_sides == '6' and pat.pave_tiles == 5:
+ if pat.pave_sides == '6' and pat.pave_tiles == 5:
numPattern = pat.pave_pat_22
- if pat.pave_sides == '4' and pat.pave_tiles == 6:
+ if pat.pave_sides == '4' and pat.pave_tiles == 6:
numPattern = pat.pave_pat_35
- if pat.pave_sides == '6' and pat.pave_tiles == 6:
- numTiles = 5
+ if pat.pave_sides == '6' and pat.pave_tiles == 6:
+ numTiles = 5
texStrg+="number_of_sides %s number_of_tiles %s pattern %s form %s \n"%(pat.pave_sides, numTiles, numPattern, pat.pave_form)
################ functions #####################################################################################################
- if pat.tex_pattern_type == 'function':
+ if pat.tex_pattern_type == 'function':
texStrg+="{ %s"%pat.func_list
texStrg+="(x"
if pat.func_plus_x != "NONE":
if pat.func_plus_x =='increase':
- texStrg+="*"
+ texStrg+="*"
if pat.func_plus_x =='plus':
texStrg+="+"
texStrg+="%.4g"%pat.func_x
texStrg+=",y"
if pat.func_plus_y != "NONE":
if pat.func_plus_y =='increase':
- texStrg+="*"
+ texStrg+="*"
if pat.func_plus_y =='plus':
texStrg+="+"
texStrg+="%.4g"%pat.func_y
texStrg+=",z"
if pat.func_plus_z != "NONE":
if pat.func_plus_z =='increase':
- texStrg+="*"
+ texStrg+="*"
if pat.func_plus_z =='plus':
texStrg+="+"
texStrg+="%.4g"%pat.func_z
@@ -672,7 +672,7 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+=",%.4g"%pat.func_P9
texStrg+=")}\n"
############## end functions ###############################################################
- if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'}:
+ if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'}:
texStrg+="color_map {\n"
numColor=0
if tex.use_color_ramp == True:
@@ -694,9 +694,9 @@ def exportPattern(texture, string_strip_hyphen):
else:
texStrg+="[0 color rgbf<0,0,0,1>]\n"
texStrg+="[1 color rgbf<1,1,1,0>]\n"
- if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'} :
- texStrg+="} \n"
- if pat.tex_pattern_type == 'brick':
+ if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'} :
+ texStrg+="} \n"
+ if pat.tex_pattern_type == 'brick':
texStrg+="brick_size <%.4g, %.4g, %.4g> mortar %.4g \n"%(pat.brick_size_x, pat.brick_size_y, pat.brick_size_z, pat.brick_mortar)
texStrg+="%s \n"%mappingDif
texStrg+="rotate <%.4g,%.4g,%.4g> \n"%(pat.tex_rot_x, pat.tex_rot_y, pat.tex_rot_z)
@@ -705,22 +705,22 @@ def exportPattern(texture, string_strip_hyphen):
texStrg+="lambda %.4g \n"%pat.modifier_lambda
texStrg+="omega %.4g \n"%pat.modifier_omega
texStrg+="frequency %.4g \n"%pat.modifier_frequency
- texStrg+="phase %.4g \n"%pat.modifier_phase
+ texStrg+="phase %.4g \n"%pat.modifier_phase
texStrg+="}\n\n"
texStrg+="#declare f%s=\n"%PATname
- texStrg+="function{pigment{%s}}\n"%PATname
+ texStrg+="function{pigment{%s}}\n"%PATname
texStrg+="\n"
return(texStrg)
-
-
+
+
def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, lampCount,
imageFormat, imgMap, imgMapTransforms, tabWrite, comments,
string_strip_hyphen, safety, col, os, preview_dir, unpacked_images):
- material_finish = materialNames[mater.name]
+ material_finish = materialNames[mater.name]
if mater.use_transparency:
trans = 1.0 - mater.alpha
else:
- trans = 0.0
+ trans = 0.0
if ((mater.specular_color.s == 0.0) or (mater.diffuse_shader == 'MINNAERT')):
# No layered texture because of aoi pattern used for minnaert and pov can't layer patterned
colored_specular_found = False
@@ -732,7 +732,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
trans = (1.0 - mater.alpha) - povFilter
else:
povFilter = 0.0
-
+
##############SF
texturesDif = ""
texturesSpec = ""
@@ -772,7 +772,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
#was the above used? --MR
t_alpha = t
- # RASTER IMAGE
+ # RASTER IMAGE
elif (t.texture.type == 'IMAGE' and t.texture.image and t.texture.pov.tex_pattern_type == 'emulator'):
proceduralFlag=False
#PACKED
@@ -782,11 +782,11 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
if not os.path.exists(unpackedfilename):
# record which images that were newly copied and can be safely
# cleaned up
- unpacked_images.append(unpackedfilename)
+ unpacked_images.append(unpackedfilename)
t.texture.image.filepath_raw=unpackedfilename
t.texture.image.save()
image_filename = unpackedfilename.replace("\\","/")
- # .replace("\\","/") to get only forward slashes as it's what POV prefers,
+ # .replace("\\","/") to get only forward slashes as it's what POV prefers,
# even on windows
t.texture.image.filepath_raw=orig_image_filename
#FILE
@@ -824,7 +824,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
#textDispName=t.texture.image.name + ".displ"
#was the above used? --MR
t_alpha = t
-
+
####################################################################################
@@ -835,7 +835,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
LocalMaterialNames.append(currentMatName)
tabWrite("\n#declare MAT_%s = \ntexture{\n" % currentMatName)
################################################################################
-
+
if mater.pov.replacement_text != "":
tabWrite("%s\n" % mater.pov.replacement_text)
#################################################################################
@@ -873,11 +873,11 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
if texturesSpec != "":
# tabWrite("\n")
tabWrite("pigment_pattern {\n")
-
+
mappingSpec =imgMapTransforms(t_spec)
if texturesSpec and texturesSpec.startswith("PAT_"):
- tabWrite("function{f%s(x,y,z).grey}\n" %texturesSpec)
- tabWrite("%s\n" % mappingSpec)
+ tabWrite("function{f%s(x,y,z).grey}\n" %texturesSpec)
+ tabWrite("%s\n" % mappingSpec)
else:
tabWrite("uv_mapping image_map{%s \"%s\" %s}\n" % \
@@ -894,9 +894,9 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
mappingAlpha = imgMapTransforms(t_alpha)
if texturesAlpha and texturesAlpha.startswith("PAT_"):
- tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha))
+ tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha))
else:
-
+
tabWrite("pigment {pigment_pattern {uv_mapping image_map" \
"{%s \"%s\" %s}%s" % \
(imageFormat(texturesAlpha), texturesAlpha,
@@ -931,7 +931,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
tabWrite("pigment {\n")
tabWrite("pigment_pattern {\n")
if texturesAlpha and texturesAlpha.startswith("PAT_"):
- tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha))
+ tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha))
else:
tabWrite("uv_mapping image_map{%s \"%s\" %s}%s}\n" % \
(imageFormat(texturesAlpha), texturesAlpha,
@@ -939,13 +939,13 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
tabWrite("pigment_map {\n")
tabWrite("[0 color rgbft<0,0,0,1,1>]\n")
#if texturesAlpha and texturesAlpha.startswith("PAT_"):
- #tabWrite("[1 pigment{%s}]\n" %texturesDif)
+ #tabWrite("[1 pigment{%s}]\n" %texturesDif)
if texturesDif and not texturesDif.startswith("PAT_"):
tabWrite("[1 uv_mapping image_map {%s \"%s\" %s} %s]\n" % \
(imageFormat(texturesDif), texturesDif,
(imgGamma + imgMap(t_dif)), mappingDif))
elif texturesDif and texturesDif.startswith("PAT_"):
- tabWrite("[1 %s]\n" %texturesDif)
+ tabWrite("[1 %s]\n" %texturesDif)
tabWrite("}\n")
tabWrite("}\n")
if texturesAlpha and texturesAlpha.startswith("PAT_"):
@@ -953,7 +953,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
else:
if texturesDif and texturesDif.startswith("PAT_"):
- tabWrite("pigment{%s}\n" %texturesDif)
+ tabWrite("pigment{%s}\n" %texturesDif)
else:
tabWrite("pigment {uv_mapping image_map {%s \"%s\" %s}%s}\n" % \
(imageFormat(texturesDif), texturesDif,
@@ -982,7 +982,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
mappingNor =imgMapTransforms(t_nor)
if texturesNorm and texturesNorm.startswith("PAT_"):
- tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor))
+ tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor))
else:
tabWrite("normal {uv_mapping bump_map " \
"{%s \"%s\" %s bump_size %.4g }%s}\n" % \
@@ -998,7 +998,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
mappingAlpha = imgMapTransforms(t_alpha)
if texturesAlpha and texturesAlpha.startswith("PAT_"):
- tabWrite("function{f%s(x,y,z).transmit %s}\n" %(texturesAlpha, mappingAlpha))
+ tabWrite("function{f%s(x,y,z).transmit %s}\n" %(texturesAlpha, mappingAlpha))
else:
tabWrite("pigment {pigment_pattern {uv_mapping image_map" \
"{%s \"%s\" %s}%s}\n" % \
@@ -1014,12 +1014,12 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
else:
tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>}\n" % \
(col[0], col[1], col[2], povFilter, trans))
-
-
+
+
if texturesSpec != "":
# Level 3 is full specular
tabWrite("finish {%s}\n" % (safety(material_finish, Level=3)))
-
+
elif colored_specular_found:
# Level 1 is no specular
tabWrite("finish {%s}\n" % (safety(material_finish, Level=1)))
@@ -1045,8 +1045,8 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
tabWrite("pigment_map {\n")
tabWrite("[0 color rgbft<0,0,0,1,1>]\n")
if texturesAlpha and texturesAlpha.startswith("PAT_"):
- tabWrite("[1 function{f%s(x,y,z).transmit}%s]\n" %(texturesAlpha, mappingAlpha))
- elif texturesDif and not texturesDif.startswith("PAT_"):
+ tabWrite("[1 function{f%s(x,y,z).transmit}%s]\n" %(texturesAlpha, mappingAlpha))
+ elif texturesDif and not texturesDif.startswith("PAT_"):
tabWrite("[1 uv_mapping image_map {%s \"%s\" %s} %s]\n" % \
(imageFormat(texturesDif), texturesDif,
(imgMap(t_dif) + imgGamma), mappingDif))
@@ -1057,9 +1057,9 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
else:
if texturesDif and texturesDif.startswith("PAT_"):
- tabWrite("pigment{%s %s}\n" %(texturesDif, mappingDif))
+ tabWrite("pigment{%s %s}\n" %(texturesDif, mappingDif))
print('XXXMEEEERDE!')
- else:
+ else:
tabWrite("pigment {\n")
tabWrite("uv_mapping image_map {\n")
#tabWrite("%s \"%s\" %s}%s\n" % \
@@ -1070,10 +1070,10 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
tabWrite("}\n")
tabWrite("%s\n" % mappingDif)
tabWrite("}\n")
-
+
if texturesSpec != "":
# Level 3 is full specular
- tabWrite("finish {%s}\n" % (safety(material_finish, Level=3)))
+ tabWrite("finish {%s}\n" % (safety(material_finish, Level=3)))
else:
# Level 2 is translated specular
tabWrite("finish {%s}\n" % (safety(material_finish, Level=2)))
@@ -1094,7 +1094,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
if texturesNorm and texturesNorm.startswith("PAT_"):
tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor))
- else:
+ else:
tabWrite("normal {uv_mapping bump_map {%s \"%s\" %s bump_size %.4g }%s}\n" % \
(imageFormat(texturesNorm), texturesNorm, imgMap(t_nor),
t_nor.normal_factor/10, mappingNor))
@@ -1114,18 +1114,18 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
tabWrite("}\n")
c += 1
-
-
+
+
# Close first layer of POV "texture" (Blender material)
tabWrite("}\n")
-
+
if ((mater.specular_color.s > 0.0) and (mater.diffuse_shader != 'MINNAERT')):
-
+
colored_specular_found = True
else:
colored_specular_found = False
-
- # Write another layered texture using invisible diffuse and metallic trick
+
+ # Write another layered texture using invisible diffuse and metallic trick
# to emulate colored specular highlights
special_texture_found = False
for t in mater.texture_slots:
@@ -1134,13 +1134,13 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
# Specular mapped textures would conflict with colored specular
# because POV can't layer over or under pigment patterned textures
special_texture_found = True
-
+
if colored_specular_found and not special_texture_found:
if comments:
tabWrite(" // colored highlights with a stransparent metallic layer\n")
else:
tabWrite("\n")
-
+
tabWrite("texture {\n")
tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, 0, 1>}\n" % \
(mater.specular_color[0], mater.specular_color[1], mater.specular_color[2]))
@@ -1155,7 +1155,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
if (t and t.texture.type == 'IMAGE' and
t.use and t.texture.image and
t.texture.pov.tex_pattern_type == 'emulator'):
- proceduralFlag=False
+ proceduralFlag=False
image_filename = path_image(t.texture.image)
imgGamma = ""
if image_filename:
@@ -1177,7 +1177,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
texturesNorm, imgMap(t_nor),
t_nor.normal_factor/10,
mappingNor))
-
+
tabWrite("}\n") # THEN IT CAN CLOSE LAST LAYER OF TEXTURE
def string_strip_hyphen(name):
@@ -1238,9 +1238,9 @@ def write_nodes(scene,povMatName,ntree,file):
else:
energy=link.from_node.inputs["Energy"].default_value
file.write(' subsurface { translucency <%.4g,%.4g,%.4g>*%s }\n'%(r,g,b,energy))
-
-
-
+
+
+
if link.from_node.bl_idname in {'PovraySpecularNode','PovrayPhongNode'}:
intensity=0
albedo=""
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 9777538c..ba763871 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -177,7 +177,7 @@ for member in dir(properties_particle): # add all "particle" panels from blende
pass
del properties_particle
-
+
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -259,7 +259,7 @@ class WorldButtonsPanel():
wld = context.world
rd = context.scene.render
return wld and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
-
+
class TextButtonsPanel():
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
@@ -276,16 +276,16 @@ from bl_ui import properties_data_mesh
# These panels are kept
properties_data_mesh.DATA_PT_custom_props_mesh.COMPAT_ENGINES.add('POVRAY_RENDER')
properties_data_mesh.DATA_PT_context_mesh.COMPAT_ENGINES.add('POVRAY_RENDER')
-
+
## make some native panels contextual to some object variable
## by recreating custom panels inheriting their properties
-
+
class PovDataButtonsPanel(properties_data_mesh.MeshButtonsPanel):
COMPAT_ENGINES = {'POVRAY_RENDER'}
POV_OBJECT_TYPES = {'PLANE', 'BOX', 'SPHERE', 'CYLINDER', 'CONE', 'TORUS', 'BLOB',
'ISOSURFACE', 'SUPERELLIPSOID', 'SUPERTORUS', 'HEIGHT_FIELD',
'PARAMETRIC', 'POLYCIRCLE'}
-
+
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
@@ -293,58 +293,58 @@ class PovDataButtonsPanel(properties_data_mesh.MeshButtonsPanel):
# We use our parent class poll func too, avoids to re-define too much things...
return (super(PovDataButtonsPanel, cls).poll(context) and
obj and obj.pov.object_as not in cls.POV_OBJECT_TYPES)
-
-
+
+
# We cannot inherit from RNA classes (like e.g. properties_data_mesh.DATA_PT_vertex_groups).
# Complex py/bpy/rna interactions (with metaclass and all) simply do not allow it to work.
# So we simply have to explicitly copy here the interesting bits. ;)
class DATA_PT_POV_normals(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_normals.bl_label
-
+
draw = properties_data_mesh.DATA_PT_normals.draw
-
+
class DATA_PT_POV_texture_space(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_texture_space.bl_label
bl_options = properties_data_mesh.DATA_PT_texture_space.bl_options
-
+
draw = properties_data_mesh.DATA_PT_texture_space.draw
-
-
+
+
class DATA_PT_POV_vertex_groups(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_vertex_groups.bl_label
-
+
draw = properties_data_mesh.DATA_PT_vertex_groups.draw
class DATA_PT_POV_shape_keys(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_shape_keys.bl_label
-
- draw = properties_data_mesh.DATA_PT_shape_keys.draw
-
+ draw = properties_data_mesh.DATA_PT_shape_keys.draw
+
+
class DATA_PT_POV_uv_texture(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_uv_texture.bl_label
-
- draw = properties_data_mesh.DATA_PT_uv_texture.draw
-
-
+
+ draw = properties_data_mesh.DATA_PT_uv_texture.draw
+
+
class DATA_PT_POV_vertex_colors(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_vertex_colors.bl_label
-
- draw = properties_data_mesh.DATA_PT_vertex_colors.draw
-
-
+
+ draw = properties_data_mesh.DATA_PT_vertex_colors.draw
+
+
class DATA_PT_POV_customdata(PovDataButtonsPanel, bpy.types.Panel):
bl_label = properties_data_mesh.DATA_PT_customdata.bl_label
- bl_options = properties_data_mesh.DATA_PT_customdata.bl_options
+ bl_options = properties_data_mesh.DATA_PT_customdata.bl_options
draw = properties_data_mesh.DATA_PT_customdata.draw
-
-
-
-del properties_data_mesh
-
+
+
+del properties_data_mesh
+
+
################################################################################
# from bl_ui import properties_data_lamp
# for member in dir(properties_data_lamp):
@@ -361,13 +361,13 @@ from bl_ui import properties_data_lamp
# These panels are kept
properties_data_lamp.DATA_PT_custom_props_lamp.COMPAT_ENGINES.add('POVRAY_RENDER')
properties_data_lamp.DATA_PT_context_lamp.COMPAT_ENGINES.add('POVRAY_RENDER')
-
+
## make some native panels contextual to some object variable
## by recreating custom panels inheriting their properties
class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel):
COMPAT_ENGINES = {'POVRAY_RENDER'}
POV_OBJECT_TYPES = {'RAINBOW'}
-
+
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
@@ -375,25 +375,25 @@ class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel):
# We use our parent class poll func too, avoids to re-define too much things...
return (super(PovLampButtonsPanel, cls).poll(context) and
obj and obj.pov.object_as not in cls.POV_OBJECT_TYPES)
-
-
+
+
# We cannot inherit from RNA classes (like e.g. properties_data_mesh.DATA_PT_vertex_groups).
# Complex py/bpy/rna interactions (with metaclass and all) simply do not allow it to work.
# So we simply have to explicitly copy here the interesting bits. ;)
-
+
class LAMP_PT_POV_preview(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_preview.bl_label
-
+
draw = properties_data_lamp.DATA_PT_preview.draw
class LAMP_PT_POV_lamp(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_lamp.bl_label
-
+
draw = properties_data_lamp.DATA_PT_lamp.draw
class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_sunsky.bl_label
-
+
@classmethod
def poll(cls, context):
lamp = context.lamp
@@ -401,11 +401,11 @@ class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel):
return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES)
draw = properties_data_lamp.DATA_PT_sunsky.draw
-
+
class LAMP_PT_POV_shadow(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_shadow.bl_label
-
- draw = properties_data_lamp.DATA_PT_shadow.draw
+
+ draw = properties_data_lamp.DATA_PT_shadow.draw
class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_area.bl_label
@@ -415,8 +415,8 @@ class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel):
lamp = context.lamp
engine = context.scene.render.engine
return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES)
-
- draw = properties_data_lamp.DATA_PT_area.draw
+
+ draw = properties_data_lamp.DATA_PT_area.draw
class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_spot.bl_label
@@ -425,20 +425,20 @@ class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel):
def poll(cls, context):
lamp = context.lamp
engine = context.scene.render.engine
- return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
- draw = properties_data_lamp.DATA_PT_spot.draw
+ return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES)
+ draw = properties_data_lamp.DATA_PT_spot.draw
class LAMP_PT_POV_falloff_curve(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_falloff_curve.bl_label
bl_options = properties_data_lamp.DATA_PT_falloff_curve.bl_options
-
+
@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)
- draw = properties_data_lamp.DATA_PT_falloff_curve.draw
+ draw = properties_data_lamp.DATA_PT_falloff_curve.draw
class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Rainbow"
@@ -448,17 +448,17 @@ class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'RAINBOW' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'RAINBOW' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'RAINBOW':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Rainbow projection angle: " + str(obj.data.spot_size))
col.label(text="Rainbow width: " + str(obj.data.spot_blend))
col.label(text="Rainbow distance: " + str(obj.data.shadow_buffer_clip_start))
@@ -466,23 +466,23 @@ class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel):
col.label(text="Rainbow falloff angle: " + str(obj.pov.falloff_angle))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.cone_update", text="Update",icon="MESH_CONE")
-
+
+ layout.operator("pov.cone_update", text="Update",icon="MESH_CONE")
+
#col.label(text="Parameters:")
col.prop(obj.data, "spot_size", text="Rainbow Projection Angle")
col.prop(obj.data, "spot_blend", text="Rainbow width")
col.prop(obj.data, "shadow_buffer_clip_start", text="Visibility distance")
col.prop(obj.pov, "arc_angle")
col.prop(obj.pov, "falloff_angle")
-
-del properties_data_lamp
+
+del properties_data_lamp
###############################################################################
-
+
class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel):
bl_label = "INI Options"
bl_options = {'DEFAULT_CLOSED'}
@@ -552,7 +552,7 @@ class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel):
col.label(text="Global Settings:")
col.prop(scene.pov, "max_trace_level", text="Ray Depth")
-
+
layout.active = scene.pov.global_settings_advanced
layout.prop(scene.pov,"charset")
align = True
@@ -562,9 +562,9 @@ class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel):
row.prop(scene.pov,"ambient_light")
row = layout.row(align = align)
row.prop(scene.pov,"irid_wavelength")
- row = layout.row(align = align)
+ row = layout.row(align = align)
row.prop(scene.pov,"max_intersections")
- row = layout.row(align = align)
+ row = layout.row(align = align)
row.prop(scene.pov,"number_of_waves")
row = layout.row(align = align)
row.prop(scene.pov,"noise_generator")
@@ -600,8 +600,8 @@ class RENDER_PT_povray_photons(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(scene.pov, "photon_adc_bailout", text="Photon ADC")
col.prop(scene.pov, "photon_gather_max")
-
-
+
+
box = layout.box()
box.label('Photon Map File:')
row = box.row()
@@ -633,19 +633,19 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
prefs = bpy.context.user_preferences.addons[__package__].preferences
layout = self.layout
scene = context.scene
-
+
layout.active = scene.pov.antialias_enable
row = layout.row()
row.prop(scene.pov, "antialias_method", text="")
-
+
if prefs.branch_feature_set_povray != 'uberpov' and scene.pov.antialias_method == '2':
col = layout.column()
col.alignment = 'CENTER'
col.label(text="Stochastic Anti Aliasing is")
col.label(text="Only Available with UberPOV")
col.label(text="Feature Set in User Preferences.")
- col.label(text="Using Type 2 (recursive) instead")
+ col.label(text="Using Type 2 (recursive) instead")
else:
row.prop(scene.pov, "jitter_enable", text="Jitter")
@@ -662,7 +662,7 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
row = layout.row()
row.prop(scene.pov, "antialias_threshold", text="AA Threshold")
row.prop(scene.pov, "antialias_gamma", text="AA Gamma")
-
+
if prefs.branch_feature_set_povray == 'uberpov':
row = layout.row()
row.prop(scene.pov, "antialias_confidence", text="AA Confidence")
@@ -706,11 +706,11 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(scene.pov, "radio_adc_bailout", slider=True)
- col.prop(scene.pov, "radio_minimum_reuse", text="Min Reuse")
+ col.prop(scene.pov, "radio_minimum_reuse", text="Min Reuse")
col.prop(scene.pov, "radio_gray_threshold", slider=True)
col.prop(scene.pov, "radio_pretrace_start", slider=True)
col.prop(scene.pov, "radio_low_error_factor", slider=True)
-
+
col = split.column()
col.prop(scene.pov, "radio_brightness")
col.prop(scene.pov, "radio_maximum_reuse", text="Max Reuse")
@@ -775,14 +775,14 @@ class MATERIAL_PT_povray_activate_node(MaterialButtonsPanel, bpy.types.Panel):
mat=context.material
ob = context.object
return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes)
-
+
def draw(self, context):
layout = self.layout
# layout.operator("pov.material_use_nodes", icon='SOUND')#'NODETREE')
# the above replaced with a context hook below:
layout.operator("WM_OT_context_toggle", text="Use POV-Ray Nodes", icon='NODETREE').data_path = \
"material.pov.material_use_nodes"
-
+
class MATERIAL_PT_povray_active_node(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Active Node Settings"
bl_context = "material"
@@ -856,21 +856,21 @@ class MATERIAL_PT_povray_reflection(MaterialButtonsPanel, bpy.types.Panel):
col = layout.column()
col.prop(mat.pov, "irid_amount", slider=True)
col.prop(mat.pov, "irid_thickness", slider=True)
- col.prop(mat.pov, "irid_turbulence", slider=True)
+ col.prop(mat.pov, "irid_turbulence", slider=True)
col.prop(mat.pov, "conserve_energy")
col2=col.split().column()
-
+
if not mat.raytrace_mirror.use:
- col2.label(text="Please Check Mirror settings :")
+ col2.label(text="Please Check Mirror settings :")
col2.active = mat.raytrace_mirror.use
col2.prop(mat.pov, "mirror_use_IOR")
if mat.pov.mirror_use_IOR:
col2.alignment = 'CENTER'
col2.label(text="The current Raytrace ")
- col2.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior))
+ col2.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior))
col2.prop(mat.pov, "mirror_metallic")
-
-
+
+
class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Absorption"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -881,8 +881,8 @@ class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel):
mat=context.material
ob = context.object
return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes)
-
-
+
+
def draw_header(self, context):
mat = context.material
@@ -896,7 +896,7 @@ class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel):
layout.label(text="Raytrace transparency")
layout.label(text="depth max Limit needs")
layout.label(text="to be non zero to fade")
-
+
pass
@@ -904,15 +904,15 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel):
bl_label = "Caustics"
COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
mat=context.material
ob = context.object
return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes)
-
-
+
+
def draw_header(self, context):
mat = context.material
if mat.pov.caustics_enable:
@@ -950,7 +950,7 @@ class MATERIAL_PT_povray_replacement_text(MaterialButtonsPanel, bpy.types.Panel)
bl_label = "Custom POV Code"
COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+
def draw(self, context):
layout = self.layout
@@ -978,7 +978,7 @@ class TEXTURE_PT_povray_preview(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Preview"
COMPAT_ENGINES = {'POVRAY_RENDER'}
bl_options = {'HIDE_HEADER'}
-
+
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
@@ -1041,9 +1041,9 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
row.prop(tex.pov, "julia_complex_1", text="Complex 1")
row.prop(tex.pov, "julia_complex_2", text="Complex 2")
row=col.row()
- if tex.pov.tex_pattern_type in {'julia','mandel'}:
+ if tex.pov.tex_pattern_type in {'julia','mandel'}:
row.prop(tex.pov, "f_exponent", text="Exponent")
- if tex.pov.tex_pattern_type == 'magnet':
+ if tex.pov.tex_pattern_type == 'magnet':
row.prop(tex.pov, "magnet_type", text="Type")
row.prop(tex.pov, "f_iter", text="Iterations")
row=col.row()
@@ -1052,17 +1052,17 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
row=col.row()
row.prop(tex.pov, "f_eor", text="Exterior")
row.prop(tex.pov, "f_eor_fac", text="Factor E")
- if tex.pov.tex_pattern_type == 'gradient':
+ if tex.pov.tex_pattern_type == 'gradient':
layout.label(text="Gradient orientation:")
column_flow = layout.column_flow(columns=3, align=True)
- column_flow.prop(tex.pov, "grad_orient_x", text="X")
+ column_flow.prop(tex.pov, "grad_orient_x", text="X")
column_flow.prop(tex.pov, "grad_orient_y", text="Y")
column_flow.prop(tex.pov, "grad_orient_z", text="Z")
if tex.pov.tex_pattern_type == 'pavement':
layout.prop(tex.pov, "pave_sides", text="Pavement:number of sides")
col = layout.column(align=align)
column_flow = col.column_flow(columns=3, align=True)
- column_flow.prop(tex.pov, "pave_tiles", text="Tiles")
+ column_flow.prop(tex.pov, "pave_tiles", text="Tiles")
if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 6:
column_flow.prop(tex.pov, "pave_pat_35", text="Pattern")
if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 5:
@@ -1087,7 +1087,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
column_flow.label(text="!!! 5 tiles!")
column_flow.prop(tex.pov, "pave_form", text="Form")
if tex.pov.tex_pattern_type == 'function':
- layout.prop(tex.pov, "func_list", text="Functions")
+ layout.prop(tex.pov, "func_list", text="Functions")
if tex.pov.tex_pattern_type == 'function' and tex.pov.func_list != "NONE":
func = None
if tex.pov.func_list in {"f_noise3d", "f_ph", "f_r", "f_th"}:
@@ -1128,15 +1128,15 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
if tex.pov.func_list == "f_helical_torus":
func = 8
column_flow = layout.column_flow(columns=3, align=True)
- column_flow.label(text="X")
+ column_flow.label(text="X")
column_flow.prop(tex.pov, "func_plus_x", text="")
column_flow.prop(tex.pov, "func_x", text="Value")
column_flow = layout.column_flow(columns=3, align=True)
- column_flow.label(text="Y")
+ column_flow.label(text="Y")
column_flow.prop(tex.pov, "func_plus_y", text="")
column_flow.prop(tex.pov, "func_y", text="Value")
column_flow = layout.column_flow(columns=3, align=True)
- column_flow.label(text="Z")
+ column_flow.label(text="Z")
column_flow.prop(tex.pov, "func_plus_z", text="")
column_flow.prop(tex.pov, "func_z", text="Value")
row=layout.row(align=align)
@@ -1171,8 +1171,8 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
if tex.pov.warp_types not in {"CUBIC","NONE"}:
layout.prop(tex.pov, "warp_orientation", text="Warp orientation")
col = layout.column(align=align)
- row = col.row()
- row.prop(tex.pov, "warp_dist_exp", text="Distance exponent")
+ row = col.row()
+ row.prop(tex.pov, "warp_dist_exp", text="Distance exponent")
row = col.row()
row.prop(tex.pov, "modifier_frequency", text="Frequency")
row.prop(tex.pov, "modifier_phase", text="Phase")
@@ -1182,7 +1182,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
row.label(text="Offset:")
row.label(text="Scale:")
row.label(text="Rotate:")
- col=layout.column(align=align)
+ col=layout.column(align=align)
row=col.row()
row.prop(tex.pov, "tex_mov_x", text="X")
row.prop(tex.pov, "tex_scale_x", text="X")
@@ -1198,7 +1198,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
row=layout.row()
row.label(text="Turbulence:")
- col=layout.column(align=align)
+ col=layout.column(align=align)
row=col.row()
row.prop(tex.pov, "warp_turbulence_x", text="X")
row.prop(tex.pov, "modifier_octaves", text="Octaves")
@@ -1208,7 +1208,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
row=col.row()
row.prop(tex.pov, "warp_turbulence_z", text="Z")
row.prop(tex.pov, "modifier_omega", text="Omega")
-
+
class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel):
bl_label = "Image Gamma"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1267,27 +1267,27 @@ class OBJECT_PT_povray_obj_sphere(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'SPHERE' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'SPHERE' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'SPHERE':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Sphere radius: " + str(obj.pov.sphere_radius))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.sphere_update", text="Update",icon="SOLID")
-
+
+ layout.operator("pov.sphere_update", text="Update",icon="SOLID")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "sphere_radius", text="Radius of Sphere")
@@ -1300,28 +1300,28 @@ class OBJECT_PT_povray_obj_cylinder(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'CYLINDER' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'CYLINDER' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'CYLINDER':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Cylinder radius: " + str(obj.pov.cylinder_radius))
col.label(text="Cylinder cap location: " + str(obj.pov.cylinder_location_cap))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.cylinder_update", text="Update",icon="MESH_CYLINDER")
-
+
+ layout.operator("pov.cylinder_update", text="Update",icon="MESH_CYLINDER")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "cylinder_radius")
col.prop(obj.pov, "cylinder_location_cap")
@@ -1334,29 +1334,29 @@ class OBJECT_PT_povray_obj_cone(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'CONE' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'CONE' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'CONE':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Cone base radius: " + str(obj.pov.cone_base_radius))
col.label(text="Cone cap radius: " + str(obj.pov.cone_cap_radius))
col.label(text="Cone proxy segments: " + str(obj.pov.cone_segments))
col.label(text="Cone height: " + str(obj.pov.cone_height))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.cone_update", text="Update",icon="MESH_CONE")
-
+
+ layout.operator("pov.cone_update", text="Update",icon="MESH_CONE")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "cone_base_radius", text="Radius of Cone Base")
col.prop(obj.pov, "cone_cap_radius", text="Radius of Cone Cap")
@@ -1371,38 +1371,38 @@ class OBJECT_PT_povray_obj_superellipsoid(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'SUPERELLIPSOID' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'SUPERELLIPSOID' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'SUPERELLIPSOID':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Radial segmentation: " + str(obj.pov.se_u))
col.label(text="Lateral segmentation: " + str(obj.pov.se_v))
col.label(text="Ring shape: " + str(obj.pov.se_n1))
col.label(text="Cross-section shape: " + str(obj.pov.se_n2))
col.label(text="Fill up and down: " + str(obj.pov.se_edit))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.superellipsoid_update", text="Update",icon="MOD_SUBSURF")
-
+
+ layout.operator("pov.superellipsoid_update", text="Update",icon="MOD_SUBSURF")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "se_u")
col.prop(obj.pov, "se_v")
col.prop(obj.pov, "se_n1")
col.prop(obj.pov, "se_n2")
col.prop(obj.pov, "se_edit")
-
-
+
+
class OBJECT_PT_povray_obj_torus(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Torus"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1411,29 +1411,29 @@ class OBJECT_PT_povray_obj_torus(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'TORUS' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'TORUS' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'TORUS':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Torus major radius: " + str(obj.pov.torus_major_radius))
col.label(text="Torus minor radius: " + str(obj.pov.torus_minor_radius))
col.label(text="Torus major segments: " + str(obj.pov.torus_major_segments))
col.label(text="Torus minor segments: " + str(obj.pov.torus_minor_segments))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.torus_update", text="Update",icon="MESH_TORUS")
-
+
+ layout.operator("pov.torus_update", text="Update",icon="MESH_TORUS")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "torus_major_radius")
col.prop(obj.pov, "torus_minor_radius")
@@ -1448,38 +1448,38 @@ class OBJECT_PT_povray_obj_supertorus(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'SUPERTORUS' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'SUPERTORUS' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'SUPERTORUS':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="SuperTorus major radius: " + str(obj.pov.st_major_radius))
col.label(text="SuperTorus minor radius: " + str(obj.pov.st_minor_radius))
col.label(text="SuperTorus major segments: " + str(obj.pov.st_u))
col.label(text="SuperTorus minor segments: " + str(obj.pov.st_v))
-
+
col.label(text="SuperTorus Ring Manipulator: " + str(obj.pov.st_ring))
col.label(text="SuperTorus Cross Manipulator: " + str(obj.pov.st_cross))
col.label(text="SuperTorus Internal And External radii: " + str(obj.pov.st_ie))
-
+
col.label(text="SuperTorus accuracy: " + str(ob.pov.st_accuracy))
col.label(text="SuperTorus max gradient: " + str(ob.pov.st_max_gradient))
-
+
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.supertorus_update", text="Update",icon="MESH_TORUS")
-
+
+ layout.operator("pov.supertorus_update", text="Update",icon="MESH_TORUS")
+
#col.label(text="Parameters:")
col.prop(obj.pov, "st_major_radius")
col.prop(obj.pov, "st_minor_radius")
@@ -1491,7 +1491,7 @@ class OBJECT_PT_povray_obj_supertorus(PovDataButtonsPanel, bpy.types.Panel):
#col.prop(obj.pov, "st_edit") #?
col.prop(obj.pov, "st_accuracy")
col.prop(obj.pov, "st_max_gradient")
-
+
class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Parametric surface"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1500,17 +1500,17 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel):
def poll(cls, context):
engine = context.scene.render.engine
obj = context.object
- return (obj and obj.pov.object_as == 'PARAMETRIC' and (engine in cls.COMPAT_ENGINES))
+ return (obj and obj.pov.object_as == 'PARAMETRIC' and (engine in cls.COMPAT_ENGINES))
def draw(self, context):
layout = self.layout
obj = context.object
-
+
col = layout.column()
if obj.pov.object_as == 'PARAMETRIC':
if obj.pov.unlock_parameters == False:
- col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED')
col.label(text="Minimum U: " + str(obj.pov.u_min))
col.label(text="Minimum V: " + str(obj.pov.v_min))
col.label(text="Maximum U: " + str(obj.pov.u_max))
@@ -1520,13 +1520,13 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel):
col.label(text="Z Function: " + str(obj.pov.x_eq))
else:
- col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
+ col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED')
col.label(text="3D view proxy may get out of synch")
col.active = obj.pov.unlock_parameters
-
- layout.operator("pov.parametric_update", text="Update",icon="SCRIPTPLUGINS")
-
+
+ layout.operator("pov.parametric_update", text="Update",icon="SCRIPTPLUGINS")
+
col.prop(obj.pov, "u_min", text="Minimum U")
col.prop(obj.pov, "v_min", text="Minimum V")
col.prop(obj.pov, "u_max", text="Maximum U")
@@ -1535,7 +1535,7 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel):
col.prop(obj.pov, "y_eq", text="Y Function")
col.prop(obj.pov, "z_eq", text="Z Function")
-
+
class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel):
bl_label = "Custom POV Code"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1552,19 +1552,19 @@ class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel):
###############################################################################
# Add Povray Objects
###############################################################################
-
+
class Povray_primitives_add_menu(bpy.types.Menu):
"""Define the menu with presets"""
bl_idname = "Povray_primitives_add_menu"
bl_label = "Povray"
COMPAT_ENGINES = {'POVRAY_RENDER'}
-
+
@classmethod
def poll(cls, context):
engine = context.scene.render.engine
- return (engine == 'POVRAY_RENDER')
-
+ return (engine == 'POVRAY_RENDER')
+
def draw(self,context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
@@ -1574,9 +1574,9 @@ class Povray_primitives_add_menu(bpy.types.Menu):
class BasicShapesMenu(bpy.types.Menu):
bl_idname = "Basic_shapes_calls"
bl_label = "Basic_shapes"
-
+
def draw(self,context):
- pov = bpy.types.Object.pov #context.object.pov ?
+ pov = bpy.types.Object.pov #context.object.pov ?
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("pov.addplane", text="Infinite Plane",icon = 'MESH_PLANE')
@@ -1604,13 +1604,13 @@ class BasicShapesMenu(bpy.types.Menu):
layout.label(text = "Macro based")
layout.operator("pov.addpolygontocircle", text="Polygon To Circle Blending",icon="RETOPO")
layout.operator("pov.addloft", text="Loft",icon="SURFACE_NSURFACE")
-
+
class ImportMenu(bpy.types.Menu):
bl_idname = "Importer_calls"
bl_label = "Import"
def draw(self,context):
- pov = bpy.types.Object.pov #context.object.pov ?
+ pov = bpy.types.Object.pov #context.object.pov ?
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("import_scene.pov",icon="FORCE_LENNARDJONES")
@@ -1618,14 +1618,14 @@ class ImportMenu(bpy.types.Menu):
def menu_func_add(self, context):
engine = context.scene.render.engine
if engine == 'POVRAY_RENDER':
- self.layout.menu("Povray_primitives_add_menu", icon="PLUGIN")
+ self.layout.menu("Povray_primitives_add_menu", icon="PLUGIN")
def menu_func_import(self, context):
engine = context.scene.render.engine
if engine == 'POVRAY_RENDER':
self.layout.operator("import_scene.pov",icon="FORCE_LENNARDJONES")
-
+
##############Nodes
# def find_node_input(node, name):
@@ -1638,7 +1638,7 @@ def menu_func_import(self, context):
# #layout.operator("pov.material_use_nodes", icon='SOUND')#'NODETREE')
# #layout.operator("pov.use_shading_nodes", icon='NODETREE')
# layout.operator("WM_OT_context_toggle", icon='NODETREE').data_path = \
- # "material.pov.material_use_nodes"
+ # "material.pov.material_use_nodes"
# return False
# ntree = id_data.node_tree
@@ -1677,7 +1677,7 @@ def menu_func_nodes(self, context):
###############################################################################
# Camera Povray Settings
-###############################################################################
+###############################################################################
class CAMERA_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Depth Of Field"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@@ -1707,7 +1707,7 @@ class CAMERA_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel):
col.prop(cam.pov, "dof_confidence")
-
+
class CAMERA_PT_povray_cam_nor(CameraDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Perturbation"
COMPAT_ENGINES = {'POVRAY_RENDER'}
diff --git a/rigify/rigs/pitchipoy/limbs/arm.py b/rigify/rigs/pitchipoy/limbs/arm.py
index 43327ec8..17bf5535 100644
--- a/rigify/rigs/pitchipoy/limbs/arm.py
+++ b/rigify/rigs/pitchipoy/limbs/arm.py
@@ -27,26 +27,26 @@ from rna_prop_ui import rna_idprop_ui_prop_get
def create_arm( cls, bones ):
org_bones = cls.org_bones
-
+
bpy.ops.object.mode_set(mode='EDIT')
eb = cls.obj.data.edit_bones
ctrl = get_bone_name( org_bones[2], 'ctrl', 'ik' )
-
+
# Create IK arm control
ctrl = copy_bone( cls.obj, org_bones[2], ctrl )
- # clear parent (so that rigify will parent to root)
+ # clear parent (so that rigify will parent to root)
eb[ ctrl ].parent = None
eb[ ctrl ].use_connect = False
- # Parent
+ # Parent
eb[ bones['ik']['mch_target'] ].parent = eb[ ctrl ]
eb[ bones['ik']['mch_target'] ].use_connect = False
-
+
# Set up constraints
# Constrain mch target bone to the ik control and mch stretch
-
+
make_constraint( cls, bones['ik']['mch_target'], {
'constraint' : 'COPY_LOCATION',
'subtarget' : bones['ik']['mch_str'],
@@ -80,7 +80,7 @@ def create_arm( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]
-
+
pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
@@ -93,7 +93,7 @@ def create_arm( cls, bones ):
b = bones['ik']['mch_str']
drv = pb[b].constraints[-1].driver_add("influence").driver
drv.type = 'SUM'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -102,7 +102,7 @@ def create_arm( cls, bones ):
pb_parent.path_from_id() + '['+ '"' + prop.name + '"' + ']'
drv_modifier = cls.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
diff --git a/rigify/rigs/pitchipoy/limbs/leg.py b/rigify/rigs/pitchipoy/limbs/leg.py
index 9176bd92..14fd6f13 100644
--- a/rigify/rigs/pitchipoy/limbs/leg.py
+++ b/rigify/rigs/pitchipoy/limbs/leg.py
@@ -31,7 +31,7 @@ def create_leg( cls, bones ):
)
bones['ik']['ctrl']['terminal'] = []
-
+
bpy.ops.object.mode_set(mode='EDIT')
eb = cls.obj.data.edit_bones
@@ -49,7 +49,7 @@ def create_leg( cls, bones ):
ctrl = get_bone_name( org_bones[2], 'ctrl', 'ik' )
ctrl = copy_bone( cls.obj, org_bones[2], ctrl )
- # clear parent (so that rigify will parent to root)
+ # clear parent (so that rigify will parent to root)
eb[ ctrl ].parent = None
eb[ ctrl ].use_connect = False
@@ -64,7 +64,7 @@ def create_leg( cls, bones ):
orient_bone( cls, eb[ ctrl ], 'y', reverse = True )
eb[ ctrl ].length = l
- # Parent
+ # Parent
eb[ heel ].use_connect = False
eb[ heel ].parent = eb[ ctrl ]
@@ -91,38 +91,38 @@ def create_leg( cls, bones ):
# Create 2nd roll mch, and two rock mch bones
roll2_mch = get_bone_name( tmp_heel, 'mch', 'roll' )
- roll2_mch = copy_bone( cls.obj, org_bones[3], roll2_mch )
+ roll2_mch = copy_bone( cls.obj, org_bones[3], roll2_mch )
eb[ roll2_mch ].use_connect = False
eb[ roll2_mch ].parent = None
-
- put_bone(
- cls.obj,
- roll2_mch,
+
+ put_bone(
+ cls.obj,
+ roll2_mch,
( eb[ tmp_heel ].head + eb[ tmp_heel ].tail ) / 2
)
eb[ roll2_mch ].length /= 4
-
+
# Rock MCH bones
rock1_mch = get_bone_name( tmp_heel, 'mch', 'rock' )
- rock1_mch = copy_bone( cls.obj, tmp_heel, rock1_mch )
+ rock1_mch = copy_bone( cls.obj, tmp_heel, rock1_mch )
eb[ rock1_mch ].use_connect = False
- eb[ rock1_mch ].parent = None
-
+ eb[ rock1_mch ].parent = None
+
orient_bone( cls, eb[ rock1_mch ], 'y', 1.0, reverse = True )
eb[ rock1_mch ].length = eb[ tmp_heel ].length / 2
-
+
rock2_mch = get_bone_name( tmp_heel, 'mch', 'rock' )
rock2_mch = copy_bone( cls.obj, tmp_heel, rock2_mch )
eb[ rock2_mch ].use_connect = False
- eb[ rock2_mch ].parent = None
+ eb[ rock2_mch ].parent = None
orient_bone( cls, eb[ rock2_mch ], 'y', 1.0 )
eb[ rock2_mch ].length = eb[ tmp_heel ].length / 2
-
+
# Parent rock and roll MCH bones
eb[ roll1_mch ].parent = eb[ roll2_mch ]
eb[ roll2_mch ].parent = eb[ rock1_mch ]
@@ -135,7 +135,7 @@ def create_leg( cls, bones ):
'subtarget' : heel,
'owner_space' : 'LOCAL',
'target_space' : 'LOCAL'
- })
+ })
make_constraint( cls, roll1_mch, {
'constraint' : 'LIMIT_ROTATION',
'use_limit_x' : True,
@@ -150,15 +150,15 @@ def create_leg( cls, bones ):
'invert_x' : True,
'owner_space' : 'LOCAL',
'target_space' : 'LOCAL'
- })
+ })
make_constraint( cls, roll2_mch, {
'constraint' : 'LIMIT_ROTATION',
'use_limit_x' : True,
'max_x' : math.radians(360),
'owner_space' : 'LOCAL'
- })
+ })
- pb = cls.obj.pose.bones
+ pb = cls.obj.pose.bones
for i,b in enumerate([ rock1_mch, rock2_mch ]):
head_tail = pb[b].head - pb[tmp_heel].head
if '.L' in b:
@@ -176,7 +176,7 @@ def create_leg( cls, bones ):
min_y = 0
max_y = math.radians(360)
-
+
make_constraint( cls, b, {
'constraint' : 'COPY_ROTATION',
'subtarget' : heel,
@@ -184,14 +184,14 @@ def create_leg( cls, bones ):
'use_z' : False,
'owner_space' : 'LOCAL',
'target_space' : 'LOCAL'
- })
+ })
make_constraint( cls, b, {
'constraint' : 'LIMIT_ROTATION',
'use_limit_y' : True,
'min_y' : min_y,
'max_y' : max_y,
'owner_space' : 'LOCAL'
- })
+ })
# Constrain 4th ORG to roll2 MCH bone
make_constraint( cls, org_bones[3], {
@@ -201,7 +201,7 @@ def create_leg( cls, bones ):
# Set up constraints
# Constrain mch target bone to the ik control and mch stretch
-
+
make_constraint( cls, bones['ik']['mch_target'], {
'constraint' : 'COPY_LOCATION',
'subtarget' : bones['ik']['mch_str'],
@@ -235,7 +235,7 @@ def create_leg( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]
-
+
pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
@@ -248,7 +248,7 @@ def create_leg( cls, bones ):
b = bones['ik']['mch_str']
drv = pb[b].constraints[-1].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -257,7 +257,7 @@ def create_leg( cls, bones ):
pb_parent.path_from_id() + '['+ '"' + prop.name + '"' + ']'
drv_modifier = cls.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
@@ -284,7 +284,7 @@ def create_leg( cls, bones ):
eb[ toes ].use_connect = False
eb[ toes ].parent = eb[ org_bones[3] ]
-
+
# Constrain toes def bones
make_constraint( cls, bones['def'][-2], {
'constraint' : 'DAMPED_TRACK',
@@ -293,8 +293,8 @@ def create_leg( cls, bones ):
make_constraint( cls, bones['def'][-2], {
'constraint' : 'STRETCH_TO',
'subtarget' : toes
- })
-
+ })
+
make_constraint( cls, bones['def'][-1], {
'constraint' : 'COPY_TRANSFORMS',
'subtarget' : toes
@@ -303,12 +303,12 @@ def create_leg( cls, bones ):
# Find IK/FK switch property
pb = cls.obj.pose.bones
prop = rna_idprop_ui_prop_get( pb[ bones['parent'] ], 'IK/FK' )
-
+
# Add driver to limit scale constraint influence
b = org_bones[3]
drv = pb[b].constraints[-1].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -317,17 +317,17 @@ def create_leg( cls, bones ):
pb_parent.path_from_id() + '['+ '"' + prop.name + '"' + ']'
drv_modifier = cls.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
drv_modifier.coefficients[1] = -1.0
-
+
# Create toe circle widget
create_circle_widget(cls.obj, toes, radius=0.4, head_tail=0.5)
bones['ik']['ctrl']['terminal'] += [ toes ]
bones['ik']['ctrl']['terminal'] += [ heel, ctrl ]
-
+
return bones
diff --git a/rigify/rigs/pitchipoy/limbs/limb_utils.py b/rigify/rigs/pitchipoy/limbs/limb_utils.py
index 73e4f472..ce6a0761 100644
--- a/rigify/rigs/pitchipoy/limbs/limb_utils.py
+++ b/rigify/rigs/pitchipoy/limbs/limb_utils.py
@@ -7,13 +7,13 @@ bilateral_suffixes = ['.L','.R']
def orient_bone( cls, eb, axis, scale = 1.0, reverse = False ):
v = Vector((0,0,0))
-
+
setattr(v,axis,scale)
if reverse:
tail_vec = v * cls.obj.matrix_world
eb.head[:] = eb.tail
- eb.tail[:] = eb.head + tail_vec
+ eb.tail[:] = eb.head + tail_vec
else:
tail_vec = v * cls.obj.matrix_world
eb.tail[:] = eb.head + tail_vec
@@ -29,22 +29,22 @@ def make_constraint( cls, bone, constraint ):
constraint['target'] = cls.obj
- # filter contraint props to those that actually exist in the currnet
+ # filter contraint props to those that actually exist in the currnet
# type of constraint, then assign values to each
for p in [ k for k in constraint.keys() if k in dir(const) ]:
if p in dir( const ):
setattr( const, p, constraint[p] )
else:
raise MetarigError(
- "RIGIFY ERROR: property %s does not exist in %s constraint" % (
+ "RIGIFY ERROR: property %s does not exist in %s constraint" % (
p, constraint['constraint']
))
def get_bone_name( name, btype, suffix = '' ):
# RE pattern match right or left parts
- # match the letter "L" (or "R"), followed by an optional dot (".")
+ # match the letter "L" (or "R"), followed by an optional dot (".")
# and 0 or more digits at the end of the the string
- pattern = r'^(\S+)(\.\S+)$'
+ pattern = r'^(\S+)(\.\S+)$'
name = strip_org( name )
@@ -60,7 +60,7 @@ def get_bone_name( name, btype, suffix = '' ):
if suffix:
results = re.match( pattern, name )
bname, addition = ('','')
-
+
if results:
bname, addition = results.groups()
name = bname + "_" + suffix + addition
diff --git a/rigify/rigs/pitchipoy/limbs/paw.py b/rigify/rigs/pitchipoy/limbs/paw.py
index 89de5e90..03ccd25f 100644
--- a/rigify/rigs/pitchipoy/limbs/paw.py
+++ b/rigify/rigs/pitchipoy/limbs/paw.py
@@ -32,7 +32,7 @@ def create_paw( cls, bones ):
bones['ik']['ctrl']['terminal'] = []
-
+
bpy.ops.object.mode_set(mode='EDIT')
eb = cls.obj.data.edit_bones
@@ -57,7 +57,7 @@ def create_paw( cls, bones ):
eb[ heel ].use_connect = False
flip_bone( cls.obj, heel )
-
+
eb[ bones['ik']['mch_target'] ].parent = eb[ heel ]
eb[ bones['ik']['mch_target'] ].use_connect = False
@@ -68,7 +68,7 @@ def create_paw( cls, bones ):
# Set up constraints
# Constrain mch target bone to the ik control and mch stretch
-
+
make_constraint( cls, bones['ik']['mch_target'], {
'constraint' : 'COPY_LOCATION',
'subtarget' : bones['ik']['mch_str'],
@@ -104,7 +104,7 @@ def create_paw( cls, bones ):
# Create ik/fk switch property
pb_parent = pb[ bones['parent'] ]
-
+
pb_parent['IK_Strertch'] = 1.0
prop = rna_idprop_ui_prop_get( pb_parent, 'IK_Strertch', create=True )
prop["min"] = 0.0
@@ -117,7 +117,7 @@ def create_paw( cls, bones ):
b = bones['ik']['mch_str']
drv = pb[b].constraints[-1].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -126,7 +126,7 @@ def create_paw( cls, bones ):
pb_parent.path_from_id() + '['+ '"' + prop.name + '"' + ']'
drv_modifier = cls.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
@@ -151,7 +151,7 @@ def create_paw( cls, bones ):
eb[ toes ].use_connect = False
eb[ toes ].parent = eb[ org_bones[3] ]
-
+
# Create toes mch bone
toes_mch = get_bone_name( org_bones[3], 'mch' )
toes_mch = copy_bone( cls.obj, org_bones[3], toes_mch )
@@ -160,7 +160,7 @@ def create_paw( cls, bones ):
eb[ toes_mch ].parent = eb[ ctrl ]
eb[ toes_mch ].length /= 4
-
+
# Constrain 4th ORG to toes MCH bone
make_constraint( cls, org_bones[3], {
'constraint' : 'COPY_TRANSFORMS',
@@ -184,12 +184,12 @@ def create_paw( cls, bones ):
# Find IK/FK switch property
pb = cls.obj.pose.bones
prop = rna_idprop_ui_prop_get( pb[ bones['parent'] ], 'IK/FK' )
-
+
# Add driver to limit scale constraint influence
b = org_bones[3]
drv = pb[b].constraints[-1].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -198,12 +198,12 @@ def create_paw( cls, bones ):
pb_parent.path_from_id() + '['+ '"' + prop.name + '"' + ']'
drv_modifier = cls.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
drv_modifier.coefficients[1] = -1.0
-
+
# Create toe circle widget
create_circle_widget(cls.obj, toes, radius=0.4, head_tail=0.5)
diff --git a/rigify/rigs/pitchipoy/limbs/super_limb.py b/rigify/rigs/pitchipoy/limbs/super_limb.py
index 40447097..b1d58ea7 100644
--- a/rigify/rigs/pitchipoy/limbs/super_limb.py
+++ b/rigify/rigs/pitchipoy/limbs/super_limb.py
@@ -47,7 +47,7 @@ class Rig:
def create_parent( self ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
@@ -58,9 +58,9 @@ class Rig:
eb[ mch ].length = eb[ org_bones[0] ].length / 4
eb[ mch ].parent = eb[ org_bones[0] ].parent
-
+
eb[ mch ].roll = 0.0
-
+
# Constraints
make_constraint( self, mch, {
'constraint' : 'COPY_ROTATION',
@@ -71,7 +71,7 @@ class Rig:
'constraint' : 'COPY_SCALE',
'subtarget' : 'root'
})
-
+
# Limb Follow Driver
pb = self.obj.pose.bones
@@ -79,7 +79,7 @@ class Rig:
pb[ mch ][ name ] = 0.0
prop = rna_idprop_ui_prop_get( pb[ mch ], name, create = True )
-
+
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
@@ -100,11 +100,11 @@ class Rig:
def create_tweak( self ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
- tweaks = {}
+ tweaks = {}
tweaks['ctrl'] = []
tweaks['mch' ] = []
@@ -116,15 +116,15 @@ class Rig:
# MCH
name = get_bone_name( strip_org(org), 'mch', 'tweak' )
mch = copy_bone( self.obj, org, name )
-
+
# CTRL
name = get_bone_name( strip_org(org), 'ctrl', 'tweak' )
ctrl = copy_bone( self.obj, org, name )
-
+
eb[ mch ].length /= self.segments
eb[ ctrl ].length /= self.segments
- # If we have more than one segments, place the head of the
+ # If we have more than one segments, place the head of the
# 2nd and onwards at the correct position
if j > 0:
put_bone(self.obj, mch, eb[ tweaks['mch' ][-1] ].tail)
@@ -137,23 +137,23 @@ class Rig:
eb[ mch ].parent = eb[ org ]
eb[ ctrl ].parent = eb[ mch ]
- else: # Last limb bone - is not subdivided
- name = get_bone_name( strip_org(org), 'mch', 'tweak' )
+ else: # Last limb bone - is not subdivided
+ name = get_bone_name( strip_org(org), 'mch', 'tweak' )
mch = copy_bone( self.obj, org_bones[i-1], name )
eb[ mch ].length = eb[org].length / 4
put_bone(
- self.obj,
+ self.obj,
mch,
eb[org_bones[i-1]].tail
- )
-
+ )
+
ctrl = get_bone_name( strip_org(org), 'ctrl', 'tweak' )
ctrl = copy_bone( self.obj, org, ctrl )
- eb[ ctrl ].length = eb[org].length / 2
+ eb[ ctrl ].length = eb[org].length / 2
tweaks['mch'] += [ mch ]
tweaks['ctrl'] += [ ctrl ]
-
+
# Parenting the tweak ctrls to mchs
eb[ mch ].parent = eb[ org ]
eb[ ctrl ].parent = eb[ mch ]
@@ -256,19 +256,19 @@ class Rig:
pb[t].lock_scale = False, True, False
create_sphere_widget(self.obj, t, bone_transform_name=None)
-
+
if self.tweak_layers:
- pb[t].bone.layers = self.tweak_layers
-
+ pb[t].bone.layers = self.tweak_layers
+
return tweaks
def create_def( self, tweaks ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
def_bones = []
for i,org in enumerate(org_bones):
if i < len(org_bones) - 1:
@@ -276,7 +276,7 @@ class Rig:
for j in range( self.segments ):
name = get_bone_name( strip_org(org), 'def' )
def_name = copy_bone( self.obj, org, name )
-
+
eb[ def_name ].length /= self.segments
# If we have more than one segments, place the 2nd and
@@ -338,7 +338,7 @@ class Rig:
pb[t][name] = 1.0
prop = rna_idprop_ui_prop_get( pb[t], name, create=True )
-
+
prop["min"] = 0.0
prop["max"] = 2.0
prop["soft_min"] = 0.0
@@ -365,13 +365,13 @@ class Rig:
var.targets[0].id = self.obj
var.targets[0].data_path = pb[tweaks[d]].path_from_id() + \
'[' + '"' + name + '"' + ']'
-
+
return def_bones
-
-
+
+
def create_ik( self, parent ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
@@ -387,7 +387,7 @@ class Rig:
# Create MCH Stretch
mch_str = copy_bone(
- self.obj,
+ self.obj,
org_bones[0],
get_bone_name( org_bones[0], 'mch', 'ik_stretch' )
)
@@ -396,13 +396,13 @@ class Rig:
eb[ mch_str ].tail = eb[ org_bones[-1] ].head
else:
eb[ mch_str ].tail = eb[ org_bones[-2] ].head
-
+
# Parenting
eb[ ctrl ].parent = eb[ parent ]
eb[ mch_str ].parent = eb[ parent ]
eb[ mch_ik ].parent = eb[ ctrl ]
-
-
+
+
make_constraint( self, mch_ik, {
'constraint' : 'IK',
'subtarget' : mch_target,
@@ -421,13 +421,13 @@ class Rig:
# Locks and Widget
pb[ ctrl ].lock_rotation = True, False, True
create_ikarrow_widget( self.obj, ctrl, bone_transform_name=None )
-
- return { 'ctrl' : { 'limb' : ctrl },
- 'mch_ik' : mch_ik,
+
+ return { 'ctrl' : { 'limb' : ctrl },
+ 'mch_ik' : mch_ik,
'mch_target' : mch_target,
'mch_str' : mch_str
}
-
+
def create_fk( self, parent ):
org_bones = self.org_bones.copy()
@@ -438,19 +438,19 @@ class Rig:
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
- ctrls = []
+ ctrls = []
for o in org_bones:
bone = copy_bone( self.obj, o, get_bone_name( o, 'ctrl', 'fk' ) )
ctrls.append( bone )
-
+
# MCH
- mch = copy_bone(
+ mch = copy_bone(
self.obj, org_bones[-1], get_bone_name( o, 'mch', 'fk' )
)
eb[ mch ].length /= 4
-
+
# Parenting
eb[ ctrls[0] ].parent = eb[ parent ]
eb[ ctrls[1] ].parent = eb[ ctrls[0] ]
@@ -464,7 +464,7 @@ class Rig:
'constraint' : 'COPY_SCALE',
'subtarget' : 'root'
})
-
+
# Locks and widgets
pb = self.obj.pose.bones
pb[ ctrls[2] ].lock_location = True, True, True
@@ -479,7 +479,7 @@ class Rig:
pb[c].bone.layers = self.fk_layers
return { 'ctrl' : ctrls, 'mch' : mch }
-
+
def org_parenting_and_switch( self, org, ik, fk, parent ):
bpy.ops.object.mode_set(mode ='EDIT')
@@ -517,11 +517,11 @@ class Rig:
'constraint' : 'COPY_TRANSFORMS',
'subtarget' : f
})
-
+
# Add driver to relevant constraint
drv = pb[o].constraints[-1].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop.name
var.type = "SINGLE_PROP"
@@ -547,48 +547,48 @@ class Rig:
for bone in self.org_bones[1:]:
eb[bone].use_connect = False
eb[bone].parent = None
-
+
bones = {}
# Create mch limb parent
bones['parent'] = self.create_parent()
- bones['tweak'] = self.create_tweak()
+ bones['tweak'] = self.create_tweak()
bones['def'] = self.create_def( bones['tweak']['ctrl'] )
bones['ik'] = self.create_ik( bones['parent'] )
bones['fk'] = self.create_fk( bones['parent'] )
- self.org_parenting_and_switch(
- self.org_bones, bones['ik'], bones['fk']['ctrl'], bones['parent']
+ self.org_parenting_and_switch(
+ self.org_bones, bones['ik'], bones['fk']['ctrl'], bones['parent']
)
bones = self.create_terminal( self.limb_type, bones )
-
+
return [ create_script( bones, self.limb_type ) ]
-
+
def add_parameters( params ):
""" Add the parameters of this rig type to the
RigifyParameters PropertyGroup
"""
items = [
- ('arm', 'Arm', ''),
- ('leg', 'Leg', ''),
+ ('arm', 'Arm', ''),
+ ('leg', 'Leg', ''),
('paw', 'Paw', '')
]
params.limb_type = bpy.props.EnumProperty(
- items = items,
- name = "Limb Type",
+ items = items,
+ name = "Limb Type",
default = 'arm'
)
items = [
- ('x', 'X', ''),
- ('y', 'Y', ''),
+ ('x', 'X', ''),
+ ('y', 'Y', ''),
('z', 'Z', '')
]
params.rotation_axis = bpy.props.EnumProperty(
- items = items,
- name = "Rotation Axis",
+ items = items,
+ name = "Rotation Axis",
default = 'x'
)
@@ -598,7 +598,7 @@ def add_parameters( params ):
min = 1,
description = 'Number of segments'
)
-
+
params.bbones = bpy.props.IntProperty(
name = 'bbone segments',
default = 10,
@@ -607,9 +607,9 @@ def add_parameters( params ):
)
# Setting up extra layers for the FK and tweak
- params.tweak_extra_layers = bpy.props.BoolProperty(
- name = "tweak_extra_layers",
- default = True,
+ params.tweak_extra_layers = bpy.props.BoolProperty(
+ name = "tweak_extra_layers",
+ default = True,
description = ""
)
@@ -618,11 +618,11 @@ def add_parameters( params ):
description = "Layers for the tweak controls to be on",
default = tuple( [ i == 1 for i in range(0, 32) ] )
)
-
+
# Setting up extra layers for the FK and tweak
- params.fk_extra_layers = bpy.props.BoolProperty(
- name = "fk_extra_layers",
- default = True,
+ params.fk_extra_layers = bpy.props.BoolProperty(
+ name = "fk_extra_layers",
+ default = True,
description = ""
)
@@ -638,7 +638,7 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "limb_type")
-
+
r = layout.row()
r.prop(params, "rotation_axis")
@@ -652,7 +652,7 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, layer + "_extra_layers")
r.active = params.tweak_extra_layers
-
+
col = r.column(align=True)
row = col.row(align=True)
@@ -716,7 +716,7 @@ def create_sample(obj):
except AttributeError:
pass
try:
- pbone.rigify_parameters.ik_layers = [
+ pbone.rigify_parameters.ik_layers = [
False, False, False, False, False, False, False, False, True, False,
False, False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False, False,
diff --git a/rigify/rigs/pitchipoy/limbs/ui.py b/rigify/rigs/pitchipoy/limbs/ui.py
index 37921dc0..a7ed95a7 100644
--- a/rigify/rigs/pitchipoy/limbs/ui.py
+++ b/rigify/rigs/pitchipoy/limbs/ui.py
@@ -29,15 +29,15 @@ if is_selected( controls ):
for t in tweaks:
if is_selected( t ):
layout.prop( pose_bones[ t ], '["%s"]', slider = True )
-
+
# IK Stretch on IK Control bone
if is_selected( ik_ctrl ):
layout.prop( pose_bones[ parent ], '["%s"]', slider = True )
-
+
# FK limb follow
if is_selected( fk_ctrl ):
layout.prop( pose_bones[ parent ], '["%s"]', slider = True )
-"""
+"""
script_leg = """
controls = [%s]
@@ -95,8 +95,8 @@ def create_script( bones, limb_type=None):
# All tweaks have their own bbone prop
tweaks = bones['tweak']['ctrl'][1:-1]
tweaks_string = ", ".join(["'" + x + "'" for x in tweaks])
-
- # IK ctrl has IK stretch
+
+ # IK ctrl has IK stretch
ik_ctrl = [ bones['ik']['ctrl']['terminal'][-1] ]
ik_ctrl += [ bones['ik']['mch_ik'] ]
ik_ctrl += [ bones['ik']['mch_target'] ]
diff --git a/rigify/rigs/pitchipoy/simple_tentacle.py b/rigify/rigs/pitchipoy/simple_tentacle.py
index 4edb15e6..9351a659 100644
--- a/rigify/rigs/pitchipoy/simple_tentacle.py
+++ b/rigify/rigs/pitchipoy/simple_tentacle.py
@@ -7,27 +7,27 @@ from ...utils import MetarigError
from rna_prop_ui import rna_idprop_ui_prop_get
class Rig:
-
+
def __init__(self, obj, bone_name, params):
self.obj = obj
self.org_bones = [bone_name] + connected_children_names(obj, bone_name)
self.params = params
self.copy_rotaion_axes = params.copy_rotaion_axes
-
+
if params.tweak_extra_layers:
self.tweak_layers = list( params.tweak_layers )
else:
self.tweak_layers = None
-
+
if len(self.org_bones) <= 1:
raise MetarigError(
"RIGIFY ERROR: invalid rig structure" % (strip_org(bone_name))
)
-
+
def make_controls( self ):
-
+
bpy.ops.object.mode_set(mode ='EDIT')
org_bones = self.org_bones
@@ -36,8 +36,8 @@ class Rig:
name = org_bones[i]
ctrl_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
strip_org(name)
)
@@ -48,12 +48,12 @@ class Rig:
for ctrl in ctrl_chain:
create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5)
-
+
return ctrl_chain
def make_tweaks( self ):
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
org_bones = self.org_bones
@@ -67,19 +67,19 @@ class Rig:
name = org_bones[i]
tweak_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
"tweak_" + strip_org(name)
)
tweak_e = eb[ tweak_bone ]
-
+
tweak_e.length /= 2 # Set size to half
-
+
if i == len( org_bones ):
# Position final tweak at the tip
put_bone( self.obj, tweak_bone, eb[ org_bones[-1]].tail )
-
+
tweak_chain.append( tweak_bone )
# Make widgets
@@ -102,12 +102,12 @@ class Rig:
# Set up tweak bone layers
if self.tweak_layers:
tweak_pb.bone.layers = self.tweak_layers
-
- return tweak_chain
+
+ return tweak_chain
def make_deform( self ):
-
+
bpy.ops.object.mode_set(mode ='EDIT')
org_bones = self.org_bones
@@ -116,18 +116,18 @@ class Rig:
name = org_bones[i]
def_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
make_deformer_name(strip_org(name))
)
def_chain.append( def_bone )
-
+
return def_chain
def parent_bones( self, all_bones ):
-
+
bpy.ops.object.mode_set(mode ='EDIT')
org_bones = self.org_bones
eb = self.obj.data.edit_bones
@@ -136,7 +136,7 @@ class Rig:
for bone in all_bones['control'][1:]:
previous_index = all_bones['control'].index( bone ) - 1
eb[ bone ].parent = eb[ all_bones['control'][previous_index] ]
-
+
# Parent tweak bones
tweaks = all_bones['tweak']
for tweak in all_bones['tweak']:
@@ -145,7 +145,7 @@ class Rig:
parent = all_bones['control'][ -1 ]
else:
parent = all_bones['control'][ tweaks.index( tweak ) ]
-
+
eb[ tweak ].parent = eb[ parent ]
# Parent deform bones
@@ -157,15 +157,15 @@ class Rig:
# Parent org bones ( to tweaks by default, or to the controls )
for org, tweak in zip( org_bones, all_bones['tweak'] ):
- eb[ org ].parent = eb[ tweak ]
-
-
+ eb[ org ].parent = eb[ tweak ]
+
+
def make_constraints( self, all_bones ):
-
+
bpy.ops.object.mode_set(mode ='OBJECT')
org_bones = self.org_bones
pb = self.obj.pose.bones
-
+
# Deform bones' constraints
ctrls = all_bones['control']
tweaks = all_bones['tweak' ]
@@ -175,15 +175,15 @@ class Rig:
con = pb[deform].constraints.new('COPY_TRANSFORMS')
con.target = self.obj
con.subtarget = tweak
-
+
con = pb[deform].constraints.new('DAMPED_TRACK')
con.target = self.obj
con.subtarget = tweaks[ tweaks.index( tweak ) + 1 ]
-
+
con = pb[deform].constraints.new('STRETCH_TO')
con.target = self.obj
con.subtarget = tweaks[ tweaks.index( tweak ) + 1 ]
-
+
# Control bones' constraints
if ctrl != ctrls[0]:
con = pb[ctrl].constraints.new('COPY_ROTATION')
@@ -198,7 +198,7 @@ class Rig:
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
-
+
def generate(self):
bpy.ops.object.mode_set(mode ='EDIT')
@@ -208,7 +208,7 @@ class Rig:
for bone in self.org_bones:
# eb[ bone ].parent = None
eb[ bone ].use_connect = False
-
+
# Creating all bones
ctrl_chain = self.make_controls()
tweak_chain = self.make_tweaks()
@@ -219,7 +219,7 @@ class Rig:
'tweak' : tweak_chain,
'deform' : def_chain
}
-
+
self.make_constraints( all_bones )
self.parent_bones( all_bones )
@@ -233,10 +233,10 @@ def add_parameters(params):
description = "Layers for the tweak controls to be on",
default = tuple( [ i == 0 for i in range(0, 3) ] )
)
-
+
# Setting up extra tweak layers
- params.tweak_extra_layers = bpy.props.BoolProperty(
- name = "tweak_extra_layers",
+ params.tweak_extra_layers = bpy.props.BoolProperty(
+ name = "tweak_extra_layers",
default = True,
description = ""
)
@@ -261,7 +261,7 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "tweak_extra_layers")
r.active = params.tweak_extra_layers
-
+
col = r.column(align=True)
row = col.row(align=True)
@@ -271,19 +271,19 @@ def parameters_ui(layout, params):
row = col.row(align=True)
for i in range( 16, 24 ): # Layers 16-23
- row.prop(params, "tweak_layers", index=i, toggle=True, text="")
-
+ row.prop(params, "tweak_layers", index=i, toggle=True, text="")
+
col = r.column(align=True)
row = col.row(align=True)
for i in range( 8, 16 ): # Layers 8-15
- row.prop(params, "tweak_layers", index=i, toggle=True, text="")
+ row.prop(params, "tweak_layers", index=i, toggle=True, text="")
row = col.row(align=True)
for i in range( 24, 32 ): # Layers 24-31
row.prop(params, "tweak_layers", index=i, toggle=True, text="")
-
+
def create_sample(obj):
# generated by rigify.utils.write_metarig
bpy.ops.object.mode_set(mode='EDIT')
@@ -297,7 +297,7 @@ def create_sample(obj):
bone.roll = 0.0000
bone.use_connect = False
bones['Bone'] = bone.name
-
+
bone = arm.edit_bones.new('Bone.002')
bone.head[:] = 0.0000, 0.0000, 0.3333
bone.tail[:] = 0.0000, 0.0000, 0.6667
@@ -305,7 +305,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['Bone']]
bones['Bone.002'] = bone.name
-
+
bone = arm.edit_bones.new('Bone.001')
bone.head[:] = 0.0000, 0.0000, 0.6667
bone.tail[:] = 0.0000, 0.0000, 1.0000
@@ -313,7 +313,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['Bone.002']]
bones['Bone.001'] = bone.name
-
+
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones[bones['Bone']]
pbone.rigify_type = 'pitchipoy.simple_tentacle'
diff --git a/rigify/rigs/pitchipoy/super_copy.py b/rigify/rigs/pitchipoy/super_copy.py
index d05d68c4..27e88775 100644
--- a/rigify/rigs/pitchipoy/super_copy.py
+++ b/rigify/rigs/pitchipoy/super_copy.py
@@ -91,22 +91,22 @@ def add_parameters(params):
""" Add the parameters of this rig type to the
RigifyParameters PropertyGroup
"""
- params.make_control = bpy.props.BoolProperty(
- name = "Control",
- default = True,
- description = "Create a control bone for the copy"
+ params.make_control = bpy.props.BoolProperty(
+ name = "Control",
+ default = True,
+ description = "Create a control bone for the copy"
)
- params.make_widget = bpy.props.BoolProperty(
- name = "Widget",
- default = True,
- description = "Choose a widget for the bone control"
+ params.make_widget = bpy.props.BoolProperty(
+ name = "Widget",
+ default = True,
+ description = "Choose a widget for the bone control"
)
- params.make_deform = bpy.props.BoolProperty(
- name = "Deform",
- default = True,
- description = "Create a deform bone for the copy"
+ params.make_deform = bpy.props.BoolProperty(
+ name = "Deform",
+ default = True,
+ description = "Create a deform bone for the copy"
)
diff --git a/rigify/rigs/pitchipoy/super_face.py b/rigify/rigs/pitchipoy/super_face.py
index 6ed7eba0..341596a1 100755
--- a/rigify/rigs/pitchipoy/super_face.py
+++ b/rigify/rigs/pitchipoy/super_face.py
@@ -18,17 +18,17 @@ if is_selected(all_controls):
layout.prop(pose_bones[eyes_ctrl_name], '["%s"]', slider=True)
"""
class Rig:
-
+
def __init__(self, obj, bone_name, params):
self.obj = obj
b = self.obj.data.bones
- children = [
- "nose", "lip.T.L", "lip.B.L", "jaw", "ear.L", "ear.R", "lip.T.R",
- "lip.B.R", "brow.B.L", "lid.T.L", "brow.B.R", "lid.T.R",
+ children = [
+ "nose", "lip.T.L", "lip.B.L", "jaw", "ear.L", "ear.R", "lip.T.R",
+ "lip.B.R", "brow.B.L", "lid.T.L", "brow.B.R", "lid.T.R",
"forehead.L", "forehead.R", "forehead.L.001", "forehead.R.001",
- "forehead.L.002", "forehead.R.002", "eye.L", "eye.R", "cheek.T.L",
+ "forehead.L.002", "forehead.R.002", "eye.L", "eye.R", "cheek.T.L",
"cheek.T.R", "teeth.T", "teeth.B", "tongue", "temple.L",
"temple.R"
]
@@ -40,7 +40,7 @@ class Rig:
for child in children:
grand_children += connected_children_names( self.obj, child )
-
+
self.org_bones = [bone_name] + children + grand_children
self.face_length = obj.data.edit_bones[ self.org_bones[0] ].length
self.params = params
@@ -58,22 +58,22 @@ class Rig:
def symmetrical_split( self, bones ):
# RE pattern match right or left parts
- # match the letter "L" (or "R"), followed by an optional dot (".")
+ # match the letter "L" (or "R"), followed by an optional dot (".")
# and 0 or more digits at the end of the the string
- left_pattern = 'L\.?\d*$'
+ left_pattern = 'L\.?\d*$'
right_pattern = 'R\.?\d*$'
left = sorted( [ name for name in bones if re.search( left_pattern, name ) ] )
- right = sorted( [ name for name in bones if re.search( right_pattern, name ) ] )
+ right = sorted( [ name for name in bones if re.search( right_pattern, name ) ] )
return left, right
-
+
def create_deformation( self ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
def_bones = []
for org in org_bones:
if 'face' in org or 'teeth' in org or 'eye' in org:
@@ -97,12 +97,12 @@ class Rig:
brow_left.reverse()
brow_right.reverse()
- for browL, browR, foreheadL, foreheadR in zip(
+ for browL, browR, foreheadL, foreheadR in zip(
brow_left, brow_right, forehead_left, forehead_right ):
eb[foreheadL].tail = eb[browL].head
eb[foreheadR].tail = eb[browR].head
-
+
return { 'all' : def_bones }
@@ -112,53 +112,53 @@ class Rig:
## create control bones
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# eyes ctrls
eyeL_e = eb[ bones['eyes'][0] ]
eyeR_e = eb[ bones['eyes'][1] ]
-
+
distance = ( eyeL_e.head - eyeR_e.head ) * 3
distance = distance.cross( (0, 0, 1) )
eye_length = eyeL_e.length
eyeL_ctrl_name = strip_org( bones['eyes'][0] )
eyeR_ctrl_name = strip_org( bones['eyes'][1] )
-
+
eyeL_ctrl_name = copy_bone( self.obj, bones['eyes'][0], eyeL_ctrl_name )
eyeR_ctrl_name = copy_bone( self.obj, bones['eyes'][1], eyeR_ctrl_name )
eyes_ctrl_name = copy_bone( self.obj, bones['eyes'][0], 'eyes' )
-
+
eyeL_ctrl_e = eb[ eyeL_ctrl_name ]
eyeR_ctrl_e = eb[ eyeR_ctrl_name ]
eyes_ctrl_e = eb[ 'eyes' ]
-
+
eyeL_ctrl_e.head += distance
eyeR_ctrl_e.head += distance
eyes_ctrl_e.head[:] = ( eyeL_ctrl_e.head + eyeR_ctrl_e.head ) / 2
-
+
for bone in [ eyeL_ctrl_e, eyeR_ctrl_e, eyes_ctrl_e ]:
bone.tail[:] = bone.head + Vector( [ 0, 0, eye_length * 0.75 ] )
## Widget for transforming the both eyes
eye_master_names = []
for bone in bones['eyes']:
- eye_master = copy_bone(
- self.obj,
- bone,
+ eye_master = copy_bone(
+ self.obj,
+ bone,
'master_' + strip_org(bone)
)
eye_master_names.append( eye_master )
-
+
## turbo: adding a master nose for transforming the whole nose
master_nose = copy_bone(self.obj, 'ORG-nose.004', 'nose_master')
eb[master_nose].tail[:] = \
eb[master_nose].head + Vector([0, self.face_length / -4, 0])
-
+
# ears ctrls
earL_name = strip_org( bones['ears'][0] )
earR_name = strip_org( bones['ears'][1] )
-
+
earL_ctrl_name = copy_bone( self.obj, org( bones['ears'][0] ), earL_name )
earR_ctrl_name = copy_bone( self.obj, org( bones['ears'][1] ), earR_name )
@@ -171,29 +171,29 @@ class Rig:
jaw_org_e = eb[ bones['jaw'][2] ]
eb[ jaw_ctrl_name ].head[:] = ( jawL_org_e.head + jawR_org_e.head ) / 2
-
+
# teeth ctrls
teethT_name = strip_org( bones['teeth'][0] )
teethB_name = strip_org( bones['teeth'][1] )
-
+
teethT_ctrl_name = copy_bone( self.obj, org( bones['teeth'][0] ), teethT_name )
teethB_ctrl_name = copy_bone( self.obj, org( bones['teeth'][1] ), teethB_name )
-
+
# tongue ctrl
tongue_org = bones['tongue'].pop()
tongue_name = strip_org( tongue_org ) + '_master'
-
+
tongue_ctrl_name = copy_bone( self.obj, tongue_org, tongue_name )
-
+
flip_bone( self.obj, tongue_ctrl_name )
-
+
## Assign widgets
bpy.ops.object.mode_set(mode ='OBJECT')
-
+
# Assign each eye widgets
create_eye_widget( self.obj, eyeL_ctrl_name )
create_eye_widget( self.obj, eyeR_ctrl_name )
-
+
# Assign eyes widgets
create_eyes_widget( self.obj, eyes_ctrl_name )
@@ -203,25 +203,25 @@ class Rig:
# Assign nose_master widget
create_square_widget( self.obj, master_nose, size = 1 )
-
+
# Assign ears widget
create_ear_widget( self.obj, earL_ctrl_name )
create_ear_widget( self.obj, earR_ctrl_name )
# Assign jaw widget
create_jaw_widget( self.obj, jaw_ctrl_name )
-
+
# Assign teeth widget
create_teeth_widget( self.obj, teethT_ctrl_name )
create_teeth_widget( self.obj, teethB_ctrl_name )
-
+
# Assign tongue widget ( using the jaw widget )
create_jaw_widget( self.obj, tongue_ctrl_name )
- return {
- 'eyes' : [
- eyeL_ctrl_name,
- eyeR_ctrl_name,
+ return {
+ 'eyes' : [
+ eyeL_ctrl_name,
+ eyeR_ctrl_name,
eyes_ctrl_name,
] + eye_master_names,
'ears' : [ earL_ctrl_name, earR_ctrl_name ],
@@ -230,7 +230,7 @@ class Rig:
'tongue' : [ tongue_ctrl_name ],
'nose' : [ master_nose ]
}
-
+
def create_tweak( self, bones, uniques, tails ):
org_bones = self.org_bones
@@ -240,7 +240,7 @@ class Rig:
eb = self.obj.data.edit_bones
tweaks = []
-
+
for bone in bones + list( uniques.keys() ):
tweak_name = strip_org( bone )
@@ -273,21 +273,21 @@ class Rig:
eb[ tweak_name ].head = eb[ bone ].tail
eb[ tweak_name ].tail[:] = \
eb[ tweak_name ].head + Vector(( 0, 0, self.face_length / 7 ))
-
+
tweaks.append( tweak_name )
-
+
bpy.ops.object.mode_set(mode ='OBJECT')
pb = self.obj.pose.bones
-
+
primary_tweaks = [
- "lid.B.L.002", "lid.T.L.002", "lid.B.R.002", "lid.T.R.002",
- "chin", "brow.T.L.001", "brow.T.L.002", "brow.T.L.003",
- "brow.T.R.001", "brow.T.R.002", "brow.T.R.003", "lip.B",
- "lip.B.L.001", "lip.B.R.001", "cheek.B.L.001", "cheek.B.R.001",
- "lips.L", "lips.R", "lip.T.L.001", "lip.T.R.001", "lip.T",
+ "lid.B.L.002", "lid.T.L.002", "lid.B.R.002", "lid.T.R.002",
+ "chin", "brow.T.L.001", "brow.T.L.002", "brow.T.L.003",
+ "brow.T.R.001", "brow.T.R.002", "brow.T.R.003", "lip.B",
+ "lip.B.L.001", "lip.B.R.001", "cheek.B.L.001", "cheek.B.R.001",
+ "lips.L", "lips.R", "lip.T.L.001", "lip.T.R.001", "lip.T",
"nose.002", "nose.L.001", "nose.R.001"
]
-
+
for bone in tweaks:
if bone in primary_tweaks:
if self.primary_layers:
@@ -297,7 +297,7 @@ class Rig:
if self.secondary_layers:
pb[bone].bone.layers = self.secondary_layers
create_face_widget( self.obj, bone )
-
+
return { 'all' : tweaks }
@@ -322,20 +322,20 @@ class Rig:
tweak_exceptions = [] # bones not used to create tweaks
tweak_exceptions += [ bone for bone in org_bones if 'forehead' in bone or 'temple' in bone ]
-
- tweak_tail = [ 'brow.B.L.003', 'brow.B.R.003', 'nose.004', 'chin.001' ]
- tweak_tail += [ 'lip.T.L.001', 'lip.T.R.001', 'tongue.002' ]
+
+ tweak_tail = [ 'brow.B.L.003', 'brow.B.R.003', 'nose.004', 'chin.001' ]
+ tweak_tail += [ 'lip.T.L.001', 'lip.T.R.001', 'tongue.002' ]
tweak_exceptions += [ 'lip.T.R', 'lip.B.R', 'ear.L.001', 'ear.R.001' ] + list(tweak_unique.keys())
tweak_exceptions += [ 'face', 'cheek.T.L', 'cheek.T.R', 'cheek.B.L', 'cheek.B.R' ]
tweak_exceptions += [ 'ear.L', 'ear.R', 'eye.L', 'eye.R' ]
-
- tweak_exceptions += org_to_ctrls.keys()
+
+ tweak_exceptions += org_to_ctrls.keys()
tweak_exceptions += org_to_ctrls['teeth']
-
+
tweak_exceptions.pop( tweak_exceptions.index('tongue') )
tweak_exceptions.pop( tweak_exceptions.index('jaw') )
-
+
tweak_exceptions = [ org( bone ) for bone in tweak_exceptions ]
tweak_tail = [ org( bone ) for bone in tweak_tail ]
@@ -343,14 +343,14 @@ class Rig:
ctrls = self.create_ctrl( org_to_ctrls )
tweaks = self.create_tweak( org_to_tweak, tweak_unique, tweak_tail )
-
+
return { 'ctrls' : ctrls, 'tweaks' : tweaks }, tweak_unique
def create_mch( self, jaw_ctrl, tongue_ctrl ):
org_bones = self.org_bones
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# Create eyes mch bones
eyes = [ bone for bone in org_bones if 'eye' in bone ]
@@ -372,24 +372,24 @@ class Rig:
eb[ mch_name ].head[:] = eb[ mch_name ].tail
eb[ mch_name ].tail[:] = eb[ mch_name ].head + Vector( ( 0, 0, 0.005 ) )
-
+
# Create the eyes' parent mch
face = [ bone for bone in org_bones if 'face' in bone ].pop()
-
+
mch_name = 'eyes_parent'
mch_name = make_mechanism_name( mch_name )
mch_name = copy_bone( self.obj, face, mch_name )
eb[ mch_name ].use_connect = False
eb[ mch_name ].parent = None
-
+
eb[ mch_name ].length /= 4
mch_bones['eyes_parent'] = [ mch_name ]
-
+
# Create the lids' mch bones
all_lids = [ bone for bone in org_bones if 'lid' in bone ]
lids_L, lids_R = self.symmetrical_split( all_lids )
-
+
all_lids = [ lids_L, lids_R ]
mch_bones['lids'] = []
@@ -403,11 +403,11 @@ class Rig:
eb[ mch_name ].parent = None
eb[ mch_name ].tail[:] = eb[ bone ].head
-
- mch_bones['lids'].append( mch_name )
-
+
+ mch_bones['lids'].append( mch_name )
+
mch_bones['jaw'] = []
-
+
length_subtractor = eb[ jaw_ctrl ].length / 6
# Create the jaw mch bones
for i in range( 6 ):
@@ -426,9 +426,9 @@ class Rig:
mch_bones['jaw'].append( mch_name )
# Tongue mch bones
-
+
mch_bones['tongue'] = []
-
+
# create mch bones for all tongue org_bones except the first one
for bone in sorted([ org for org in org_bones if 'tongue' in org ])[1:]:
mch_name = make_mechanism_name( strip_org( bone ) )
@@ -436,18 +436,18 @@ class Rig:
eb[ mch_name ].use_connect = False
eb[ mch_name ].parent = None
-
+
mch_bones['tongue'].append( mch_name )
-
+
return mch_bones
-
+
def parent_bones( self, all_bones, tweak_unique ):
org_bones = self.org_bones
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
face_name = [ bone for bone in org_bones if 'face' in bone ].pop()
-
+
# Initially parenting all bones to the face org bone.
for category in list( all_bones.keys() ):
for area in list( all_bones[category] ):
@@ -455,7 +455,7 @@ class Rig:
eb[ bone ].parent = eb[ face_name ]
## Parenting all deformation bones and org bones
-
+
# Parent all the deformation bones that have respective tweaks
def_tweaks = [ bone for bone in all_bones['deform']['all'] if bone[4:] in all_bones['tweaks']['all'] ]
@@ -464,10 +464,10 @@ class Rig:
eb[ bone ].parent = eb[ org('face') ]
for bone in def_tweaks:
- # the def and the matching org bone are parented to their corresponding tweak,
+ # the def and the matching org bone are parented to their corresponding tweak,
# whose name is the same as that of the def bone, without the "DEF-" (first 4 chars)
eb[ bone ].parent = eb[ bone[4:] ]
- eb[ org( bone[4:] ) ].parent = eb[ bone[4:] ]
+ eb[ org( bone[4:] ) ].parent = eb[ bone[4:] ]
# Parent ORG eyes to corresponding mch bones
for bone in [ bone for bone in org_bones if 'eye' in bone ]:
@@ -478,10 +478,10 @@ class Rig:
# example: 'lip.B' matches 'DEF-lip.B.R' and 'DEF-lip.B.L' if
# you cut off the "DEF-" [4:] and the ".L" or ".R" [:-2]
lip_defs = [ bone for bone in all_bones['deform']['all'] if bone[4:-2] == lip_tweak ]
-
+
for bone in lip_defs:
eb[bone].parent = eb[ lip_tweak ]
-
+
# parent cheek bones top respetive tweaks
lips = [ 'lips.L', 'lips.R' ]
brows = [ 'brow.T.L', 'brow.T.R' ]
@@ -491,11 +491,11 @@ class Rig:
for lip, brow, cheekB, cheekT in zip( lips, brows, cheekB_defs, cheekT_defs ):
eb[ cheekB ].parent = eb[ lip ]
eb[ cheekT ].parent = eb[ brow ]
-
+
# parent ear deform bones to their controls
ear_defs = [ 'DEF-ear.L', 'DEF-ear.L.001', 'DEF-ear.R', 'DEF-ear.R.001' ]
ear_ctrls = [ 'ear.L', 'ear.R' ]
-
+
eb[ 'DEF-jaw' ].parent = eb[ 'jaw' ] # Parent jaw def bone to jaw tweak
for ear_ctrl in ear_ctrls:
@@ -505,30 +505,30 @@ class Rig:
# Parent eyelid deform bones (each lid def bone is parented to its respective MCH bone)
def_lids = [ bone for bone in all_bones['deform']['all'] if 'lid' in bone ]
-
+
for bone in def_lids:
mch = make_mechanism_name( bone[4:] )
eb[ bone ].parent = eb[ mch ]
-
+
## Parenting all mch bones
-
+
eb[ 'MCH-eyes_parent' ].parent = None # eyes_parent will be parented to root
-
+
# parent all mch tongue bones to the jaw master control bone
for bone in all_bones['mch']['tongue']:
eb[ bone ].parent = eb[ all_bones['ctrls']['jaw'][0] ]
## Parenting the control bones
-
+
# parent teeth.B and tongue master controls to the jaw master control bone
for bone in [ 'teeth.B', 'tongue_master' ]:
eb[ bone ].parent = eb[ all_bones['ctrls']['jaw'][0] ]
# eyes
eb[ 'eyes' ].parent = eb[ 'MCH-eyes_parent' ]
-
- eyes = [
- bone for bone in all_bones['ctrls']['eyes'] if 'eyes' not in bone
+
+ eyes = [
+ bone for bone in all_bones['ctrls']['eyes'] if 'eyes' not in bone
][0:2]
for eye in eyes:
@@ -539,17 +539,17 @@ class Rig:
eb[ eye_master ].parent = eb[ 'ORG-face' ]
# Parent brow.b, eyes mch and lid tweaks and mch bones to masters
- tweaks = [
+ tweaks = [
b for b in all_bones['tweaks']['all'] if 'lid' in b or 'brow.B' in b
]
mch = all_bones['mch']['lids'] + \
all_bones['mch']['eye.R'] + \
all_bones['mch']['eye.L']
-
+
everyone = tweaks + mch
-
+
left, right = self.symmetrical_split( everyone )
-
+
for l in left:
eb[ l ].parent = eb[ 'master_eye.L' ]
@@ -557,7 +557,7 @@ class Rig:
eb[ r ].parent = eb[ 'master_eye.R' ]
## turbo: nose to mch jaw.004
- eb[ all_bones['ctrls']['nose'].pop() ].parent = eb['MCH-jaw_master.004']
+ eb[ all_bones['ctrls']['nose'].pop() ].parent = eb['MCH-jaw_master.004']
## Parenting the tweak bones
@@ -600,12 +600,12 @@ class Rig:
'nose.L.001',
'nose.R.001'
]
- }
-
+ }
+
for parent in list( groups.keys() ):
for bone in groups[parent]:
eb[ bone ].parent = eb[ parent ]
-
+
# Remaining arbitrary relatioships for tweak bone parenting
eb[ 'chin.001' ].parent = eb[ 'chin' ]
eb[ 'chin.002' ].parent = eb[ 'lip.B' ]
@@ -620,14 +620,14 @@ class Rig:
eb[ bone ].parent = eb[ 'ear.L' ]
eb[ bone.replace( '.L', '.R' ) ].parent = eb[ 'ear.R' ]
-
+
def make_constraits( self, constraint_type, bone, subtarget, influence = 1 ):
org_bones = self.org_bones
bpy.ops.object.mode_set(mode ='OBJECT')
pb = self.obj.pose.bones
owner_pb = pb[bone]
-
+
if constraint_type == 'def_tweak':
const = owner_pb.constraints.new( 'DAMPED_TRACK' )
@@ -649,28 +649,28 @@ class Rig:
const.target = self.obj
const.subtarget = subtarget
const.head_tail = 1.0
-
+
elif constraint_type == 'mch_eyes':
-
+
const = owner_pb.constraints.new( 'DAMPED_TRACK' )
const.target = self.obj
const.subtarget = subtarget
-
+
elif constraint_type == 'mch_eyes_lids_follow':
const = owner_pb.constraints.new( 'COPY_LOCATION' )
const.target = self.obj
const.subtarget = subtarget
const.head_tail = 1.0
-
+
elif constraint_type == 'mch_eyes_parent':
-
+
const = owner_pb.constraints.new( 'COPY_TRANSFORMS' )
const.target = self.obj
const.subtarget = subtarget
-
+
elif constraint_type == 'mch_jaw_master':
-
+
const = owner_pb.constraints.new( 'COPY_TRANSFORMS' )
const.target = self.obj
const.subtarget = subtarget
@@ -682,9 +682,9 @@ class Rig:
const.target = self.obj
const.subtarget = subtarget
const.influence = influence
-
+
elif constraint_type == 'tweak_copyloc':
-
+
const = owner_pb.constraints.new( 'COPY_LOCATION' )
const.target = self.obj
const.subtarget = subtarget
@@ -692,25 +692,25 @@ class Rig:
const.use_offset = True
const.target_space = 'LOCAL'
const.owner_space = 'LOCAL'
-
+
elif constraint_type == 'tweak_copy_rot_scl':
-
+
const = owner_pb.constraints.new( 'COPY_ROTATION' )
const.target = self.obj
const.subtarget = subtarget
const.use_offset = True
const.target_space = 'LOCAL'
const.owner_space = 'LOCAL'
-
+
const = owner_pb.constraints.new( 'COPY_SCALE' )
const.target = self.obj
const.subtarget = subtarget
const.use_offset = True
const.target_space = 'LOCAL'
const.owner_space = 'LOCAL'
-
+
elif constraint_type == 'tweak_copyloc_inv':
-
+
const = owner_pb.constraints.new( 'COPY_LOCATION' )
const.target = self.obj
const.subtarget = subtarget
@@ -721,18 +721,18 @@ class Rig:
const.invert_x = True
const.invert_y = True
const.invert_z = True
-
+
elif constraint_type == 'mch_tongue_copy_trans':
-
+
const = owner_pb.constraints.new( 'COPY_TRANSFORMS' )
const.target = self.obj
const.subtarget = subtarget
const.influence = influence
-
+
def constraints( self, all_bones ):
## Def bone constraints
-
+
def_specials = {
# 'bone' : 'target'
'DEF-jaw' : 'chin',
@@ -780,42 +780,42 @@ class Rig:
else:
tweak = "".join( matches ) + ".001"
self.make_constraits('def_tweak', bone, tweak )
-
+
def_lids = sorted( [ bone for bone in all_bones['deform']['all'] if 'lid' in bone ] )
mch_lids = sorted( [ bone for bone in all_bones['mch']['lids'] ] )
-
+
def_lidsL, def_lidsR = self.symmetrical_split( def_lids )
mch_lidsL, mch_lidsR = self.symmetrical_split( mch_lids )
# Take the last mch_lid bone and place it at the end
mch_lidsL = mch_lidsL[1:] + [ mch_lidsL[0] ]
mch_lidsR = mch_lidsR[1:] + [ mch_lidsR[0] ]
-
+
for boneL, boneR, mchL, mchR in zip( def_lidsL, def_lidsR, mch_lidsL, mch_lidsR ):
self.make_constraits('def_lids', boneL, mchL )
self.make_constraits('def_lids', boneR, mchR )
## MCH constraints
-
+
# mch lids constraints
for bone in all_bones['mch']['lids']:
tweak = bone[4:] # remove "MCH-" from bone name
self.make_constraits('mch_eyes', bone, tweak )
-
+
# mch eyes constraints
for bone in [ 'MCH-eye.L', 'MCH-eye.R' ]:
ctrl = bone[4:] # remove "MCH-" from bone name
self.make_constraits('mch_eyes', bone, ctrl )
-
+
for bone in [ 'MCH-eye.L.001', 'MCH-eye.R.001' ]:
target = bone[:-4] # remove number from the end of the name
self.make_constraits('mch_eyes_lids_follow', bone, target )
-
+
# mch eyes parent constraints
self.make_constraits('mch_eyes_parent', 'MCH-eyes_parent', 'ORG-face' )
-
+
## Jaw constraints
-
+
# jaw master mch bones
self.make_constraits( 'mch_jaw_master', 'MCH-mouth_lock', 'jaw_master', 0.20 )
self.make_constraits( 'mch_jaw_master', 'MCH-jaw_master', 'jaw_master', 1.00 )
@@ -829,9 +829,9 @@ class Rig:
for bone in all_bones['mch']['jaw'][1:-1]:
self.make_constraits( 'mch_jaw_master', bone, 'MCH-mouth_lock' )
-
+
## Tweak bones constraints
-
+
# copy location constraints for tweak bones of both sides
tweak_copyloc_L = {
'brow.T.L.002' : [ [ 'brow.T.L.001', 'brow.T.L.003' ], [ 0.5, 0.5 ] ],
@@ -853,15 +853,15 @@ class Rig:
'lip.T.L.001' : [ [ 'lips.L', 'lip.T' ], [ 0.25, 0.5 ] ],
'lip.B.L.001' : [ [ 'lips.L', 'lip.B' ], [ 0.25, 0.5 ] ]
}
-
+
for owner in list( tweak_copyloc_L.keys() ):
-
+
targets, influences = tweak_copyloc_L[owner]
for target, influence in zip( targets, influences ):
- # Left side constraints
+ # Left side constraints
self.make_constraits( 'tweak_copyloc', owner, target, influence )
-
+
# create constraints for the right side too
ownerR = owner.replace( '.L', '.R' )
targetR = target.replace( '.L', '.R' )
@@ -872,7 +872,7 @@ class Rig:
'lip.T.L.001' : 'lip.T',
'lip.B.L.001' : 'lip.B'
}
-
+
for owner in list( tweak_copy_rot_scl_L.keys() ):
target = tweak_copy_rot_scl_L[owner]
influence = tweak_copy_rot_scl_L[owner]
@@ -881,7 +881,7 @@ class Rig:
# create constraints for the right side too
owner = owner.replace( '.L', '.R' )
self.make_constraits( 'tweak_copy_rot_scl', owner, target )
-
+
# inverted tweak bones constraints
tweak_nose = {
'nose.001' : [ 'nose.002', 0.35 ],
@@ -889,12 +889,12 @@ class Rig:
'nose.005' : [ 'lip.T', 0.5 ],
'chin.002' : [ 'lip.B', 0.5 ]
}
-
+
for owner in list( tweak_nose.keys() ):
target = tweak_nose[owner][0]
influence = tweak_nose[owner][1]
self.make_constraits( 'tweak_copyloc_inv', owner, target, influence )
-
+
# MCH tongue constraints
divider = len( all_bones['mch']['tongue'] ) + 1
factor = len( all_bones['mch']['tongue'] )
@@ -905,16 +905,16 @@ class Rig:
def drivers_and_props( self, all_bones ):
-
+
bpy.ops.object.mode_set(mode ='OBJECT')
pb = self.obj.pose.bones
-
+
jaw_ctrl = all_bones['ctrls']['jaw'][0]
eyes_ctrl = all_bones['ctrls']['eyes'][2]
jaw_prop = 'mouth_lock'
eyes_prop = 'eyes_follow'
-
+
for bone, prop_name in zip( [ jaw_ctrl, eyes_ctrl ], [ jaw_prop, eyes_prop ] ):
if bone == jaw_ctrl:
pb[ bone ][ prop_name ] = 0.0
@@ -927,33 +927,33 @@ class Rig:
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = prop_name
-
+
# Jaw drivers
mch_jaws = all_bones['mch']['jaw'][1:-1]
-
+
for bone in mch_jaws:
drv = pb[ bone ].constraints[1].driver_add("influence").driver
drv.type='SUM'
-
+
var = drv.variables.new()
var.name = jaw_prop
var.type = "SINGLE_PROP"
var.targets[0].id = self.obj
var.targets[0].data_path = pb[ jaw_ctrl ].path_from_id() + '['+ '"' + jaw_prop + '"' + ']'
-
+
# Eyes driver
mch_eyes_parent = all_bones['mch']['eyes_parent'][0]
drv = pb[ mch_eyes_parent ].constraints[0].driver_add("influence").driver
drv.type='SUM'
-
+
var = drv.variables.new()
var.name = eyes_prop
var.type = "SINGLE_PROP"
var.targets[0].id = self.obj
var.targets[0].data_path = pb[ eyes_ctrl ].path_from_id() + '['+ '"' + eyes_prop + '"' + ']'
-
+
return jaw_prop, eyes_prop
def create_bones(self):
@@ -967,58 +967,58 @@ class Rig:
eb[bone].parent = None
all_bones = {}
-
+
def_names = self.create_deformation()
ctrls, tweak_unique = self.all_controls()
- mchs = self.create_mch(
- ctrls['ctrls']['jaw'][0],
- ctrls['ctrls']['tongue'][0]
+ mchs = self.create_mch(
+ ctrls['ctrls']['jaw'][0],
+ ctrls['ctrls']['tongue'][0]
)
- return {
- 'deform' : def_names,
- 'ctrls' : ctrls['ctrls'],
- 'tweaks' : ctrls['tweaks'],
- 'mch' : mchs
+ return {
+ 'deform' : def_names,
+ 'ctrls' : ctrls['ctrls'],
+ 'tweaks' : ctrls['tweaks'],
+ 'mch' : mchs
}, tweak_unique
def generate(self):
-
+
all_bones, tweak_unique = self.create_bones()
self.parent_bones( all_bones, tweak_unique )
self.constraints( all_bones )
jaw_prop, eyes_prop = self.drivers_and_props( all_bones )
-
+
# Create UI
all_controls = []
all_controls += [ bone for bone in [ bgroup for bgroup in [ all_bones['ctrls'][group] for group in list( all_bones['ctrls'].keys() ) ] ] ]
all_controls += [ bone for bone in [ bgroup for bgroup in [ all_bones['tweaks'][group] for group in list( all_bones['tweaks'].keys() ) ] ] ]
-
+
all_ctrls = []
for group in all_controls:
for bone in group:
all_ctrls.append( bone )
-
+
controls_string = ", ".join(["'" + x + "'" for x in all_ctrls])
return [ script % (
- controls_string,
+ controls_string,
all_bones['ctrls']['jaw'][0],
all_bones['ctrls']['eyes'][2],
jaw_prop,
eyes_prop )
]
-
-
+
+
def add_parameters(params):
""" Add the parameters of this rig type to the
RigifyParameters PropertyGroup
"""
#Setting up extra layers for the tweak bones
- params.primary_layers_extra = bpy.props.BoolProperty(
- name = "primary_layers_extra",
- default = True,
+ params.primary_layers_extra = bpy.props.BoolProperty(
+ name = "primary_layers_extra",
+ default = True,
description = ""
)
params.primary_layers = bpy.props.BoolVectorProperty(
@@ -1026,9 +1026,9 @@ def add_parameters(params):
description = "Layers for the 1st tweak controls to be on",
default = tuple( [ i == 1 for i in range(0, 32) ] )
)
- params.secondary_layers_extra = bpy.props.BoolProperty(
- name = "secondary_layers_extra",
- default = True,
+ params.secondary_layers_extra = bpy.props.BoolProperty(
+ name = "secondary_layers_extra",
+ default = True,
description = ""
)
params.secondary_layers = bpy.props.BoolVectorProperty(
@@ -1041,12 +1041,12 @@ def add_parameters(params):
def parameters_ui(layout, params):
""" Create the ui for the rig parameters."""
layers = ["primary_layers", "secondary_layers"]
-
+
for layer in layers:
r = layout.row()
r.prop( params, layer + "_extra" )
r.active = getattr( params, layer + "_extra" )
-
+
col = r.column(align=True)
row = col.row(align=True)
for i in range(8):
@@ -1055,10 +1055,10 @@ def parameters_ui(layout, params):
row = col.row(align=True)
for i in range(16,24):
row.prop(params, layer, index=i, toggle=True, text="")
-
+
col = r.column(align=True)
row = col.row(align=True)
-
+
for i in range(8,16):
row.prop(params, layer, index=i, toggle=True, text="")
@@ -2381,10 +2381,10 @@ def create_square_widget(rig, bone_name, size=1.0, bone_transform_name=None):
obj = create_widget(rig, bone_name, bone_transform_name)
if obj is not None:
verts = [
- ( 0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
- ( -0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
- ( 0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
- ( -0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
+ ( 0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
+ ( -0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
+ ( 0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
+ ( -0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
]
edges = [(0, 1), (2, 3), (0, 2), (3, 1) ]
diff --git a/rigify/rigs/pitchipoy/super_finger.py b/rigify/rigs/pitchipoy/super_finger.py
index 86733921..6a9c5f09 100644
--- a/rigify/rigs/pitchipoy/super_finger.py
+++ b/rigify/rigs/pitchipoy/super_finger.py
@@ -14,58 +14,58 @@ if is_selected(controls):
"""
class Rig:
-
+
def __init__(self, obj, bone_name, params):
self.obj = obj
self.org_bones = [bone_name] + connected_children_names(obj, bone_name)
self.params = params
-
+
if len(self.org_bones) <= 1:
- raise MetarigError("RIGIFY ERROR: Bone '%s': listen bro, that finger rig jusaint put tugetha rite. A little hint, use more than one bone!!" % (strip_org(bone_name)))
+ raise MetarigError("RIGIFY ERROR: Bone '%s': listen bro, that finger rig jusaint put tugetha rite. A little hint, use more than one bone!!" % (strip_org(bone_name)))
def generate(self):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# Bone name lists
ctrl_chain = []
def_chain = []
mch_chain = []
mch_drv_chain = []
-
+
# Create ctrl master bone
org_name = self.org_bones[0]
temp_name = strip_org(self.org_bones[0])
-
+
suffix = temp_name[-2:]
master_name = temp_name[:-5] + "_master" + suffix
master_name = copy_bone( self.obj, org_name, master_name )
ctrl_bone_master = eb[ master_name ]
-
+
## Parenting bug fix ??
ctrl_bone_master.use_connect = False
ctrl_bone_master.parent = None
-
+
ctrl_bone_master.tail += ( eb[ org_bones[-1] ].tail - eb[org_name].head ) * 1.25
for bone in org_bones:
eb[bone].use_connect = False
if org_bones.index( bone ) != 0:
eb[bone].parent = None
-
+
# Creating the bone chains
for i in range(len(self.org_bones)):
-
+
name = self.org_bones[i]
ctrl_name = strip_org(name)
-
+
# Create control bones
ctrl_bone = copy_bone( self.obj, name, ctrl_name )
ctrl_bone_e = eb[ ctrl_name ]
-
+
# Create deformation bones
def_name = make_deformer_name( ctrl_name )
def_bone = copy_bone( self.obj, name, def_name )
@@ -73,26 +73,26 @@ class Rig:
# Create mechanism bones
mch_name = make_mechanism_name( ctrl_name )
mch_bone = copy_bone( self.obj, name, mch_name )
-
+
# Create mechanism driver bones
drv_name = make_mechanism_name(ctrl_name) + "_drv"
mch_bone_drv = copy_bone(self.obj, name, drv_name)
mch_bone_drv_e = eb[drv_name]
-
+
# Adding to lists
ctrl_chain += [ctrl_name]
- def_chain += [def_bone]
+ def_chain += [def_bone]
mch_chain += [mch_bone]
mch_drv_chain += [drv_name]
-
+
# Restoring org chain parenting
for bone in org_bones[1:]:
eb[bone].parent = eb[ org_bones[ org_bones.index(bone) - 1 ] ]
-
+
# Parenting the master bone to the first org
ctrl_bone_master = eb[ master_name ]
ctrl_bone_master.parent = eb[ org_bones[0] ]
-
+
# Parenting chain bones
for i in range(len(self.org_bones)):
# Edit bone references
@@ -100,7 +100,7 @@ class Rig:
ctrl_bone_e = eb[ctrl_chain[i]]
mch_bone_e = eb[mch_chain[i]]
mch_bone_drv_e = eb[mch_drv_chain[i]]
-
+
if i == 0:
# First ctl bone
ctrl_bone_e.parent = mch_bone_drv_e
@@ -117,19 +117,19 @@ class Rig:
else:
# The rest
ctrl_bone_e.parent = mch_bone_drv_e
- ctrl_bone_e.use_connect = False
-
+ ctrl_bone_e.use_connect = False
+
def_bone_e.parent = eb[def_chain[i-1]]
def_bone_e.use_connect = True
-
+
mch_bone_drv_e.parent = eb[ctrl_chain[i-1]]
mch_bone_drv_e.use_connect = False
# Parenting mch bone
mch_bone_e.parent = ctrl_bone_e
mch_bone_e.use_connect = False
-
- # Creating tip conrtol bone
+
+ # Creating tip conrtol bone
tip_name = copy_bone( self.obj, org_bones[-1], temp_name )
ctrl_bone_tip = eb[ tip_name ]
flip_bone( self.obj, tip_name )
@@ -138,17 +138,17 @@ class Rig:
ctrl_bone_tip.parent = eb[ctrl_chain[-1]]
bpy.ops.object.mode_set(mode ='OBJECT')
-
+
pb = self.obj.pose.bones
-
+
# Setting pose bones locks
pb_master = pb[master_name]
pb_master.lock_scale = True,False,True
-
+
pb[tip_name].lock_scale = True,True,True
pb[tip_name].lock_rotation = True,True,True
pb[tip_name].lock_rotation_w = True
-
+
pb_master['finger_curve'] = 0.0
prop = rna_idprop_ui_prop_get(pb_master, 'finger_curve')
prop["min"] = 0.0
@@ -159,7 +159,7 @@ class Rig:
# Pose settings
for org, ctrl, deform, mch, mch_drv in zip(self.org_bones, ctrl_chain, def_chain, mch_chain, mch_drv_chain):
-
+
# Constraining the org bones
#con = pb[org].constraints.new('COPY_TRANSFORMS')
#con.target = self.obj
@@ -169,31 +169,31 @@ class Rig:
con = pb[deform].constraints.new('COPY_TRANSFORMS')
con.target = self.obj
con.subtarget = mch
-
+
# Constraining the mch bones
if mch_chain.index(mch) == 0:
con = pb[mch].constraints.new('COPY_LOCATION')
con.target = self.obj
con.subtarget = ctrl
-
+
con = pb[mch].constraints.new('COPY_SCALE')
con.target = self.obj
con.subtarget = ctrl
-
+
con = pb[mch].constraints.new('DAMPED_TRACK')
con.target = self.obj
con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1]
-
+
con = pb[mch].constraints.new('STRETCH_TO')
con.target = self.obj
con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1]
con.volume = 'NO_VOLUME'
-
+
elif mch_chain.index(mch) == len(mch_chain) - 1:
con = pb[mch].constraints.new('DAMPED_TRACK')
con.target = self.obj
con.subtarget = tip_name
-
+
con = pb[mch].constraints.new('STRETCH_TO')
con.target = self.obj
con.subtarget = tip_name
@@ -202,7 +202,7 @@ class Rig:
con = pb[mch].constraints.new('DAMPED_TRACK')
con.target = self.obj
con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1]
-
+
con = pb[mch].constraints.new('STRETCH_TO')
con.target = self.obj
con.subtarget = ctrl_chain[ctrl_chain.index(ctrl)+1]
@@ -210,19 +210,19 @@ class Rig:
# Constraining and driving mch driver bones
pb[mch_drv].rotation_mode = 'YZX'
-
+
if mch_drv_chain.index(mch_drv) == 0:
# Constraining to master bone
con = pb[mch_drv].constraints.new('COPY_LOCATION')
con.target = self.obj
con.subtarget = master_name
-
+
con = pb[mch_drv].constraints.new('COPY_ROTATION')
con.target = self.obj
con.subtarget = master_name
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
-
+
else:
# Match axis to expression
options = {
@@ -239,7 +239,7 @@ class Rig:
"-Z" : { "axis" : 2,
"expr" : '-((1-sy)*pi)' }
}
-
+
axis = self.params.primary_rotation_axis
# Drivers
@@ -251,7 +251,7 @@ class Rig:
drv_var.type = "SINGLE_PROP"
drv_var.targets[0].id = self.obj
drv_var.targets[0].data_path = pb[master_name].path_from_id() + '.scale.y'
-
+
# Setting bone curvature setting, costum property, and drivers
def_bone = self.obj.data.bones[deform]
@@ -264,7 +264,7 @@ class Rig:
drv_var.type = "SINGLE_PROP"
drv_var.targets[0].id = self.obj
drv_var.targets[0].data_path = pb_master.path_from_id() + '["finger_curve"]'
-
+
drv = def_bone.driver_add("bbone_out").driver # Ease out
drv.type='SUM'
@@ -274,10 +274,10 @@ class Rig:
drv_var.targets[0].id = self.obj
drv_var.targets[0].data_path = pb_master.path_from_id() + '["finger_curve"]'
-
+
# Assigning shapes to control bones
create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5)
-
+
# Create ctrl master widget
w = create_widget(self.obj, master_name)
if w is not None:
@@ -292,17 +292,17 @@ class Rig:
edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 1)]
mesh.from_pydata(verts, edges, [])
mesh.update()
-
+
# Create tip control widget
create_circle_widget(self.obj, tip_name, radius=0.3, head_tail=0.0)
-
+
# Create UI
controls_string = ", ".join(
["'" + x + "'" for x in ctrl_chain]
) + ", " + "'" + master_name + "'"
return [script % (controls_string, master_name, 'finger_curve')]
-
-
+
+
def add_parameters(params):
""" Add the parameters of this rig type to the
RigifyParameters PropertyGroup
@@ -316,9 +316,9 @@ def parameters_ui(layout, params):
"""
r = layout.row()
r.label(text="Bend rotation axis:")
- r.prop(params, "primary_rotation_axis", text="")
-
-
+ r.prop(params, "primary_rotation_axis", text="")
+
+
def create_sample(obj):
# generated by rigify.utils.write_metarig
bpy.ops.object.mode_set(mode='EDIT')
@@ -406,9 +406,9 @@ def create_sample(obj):
bone.select = True
bone.select_head = True
bone.select_tail = True
- arm.edit_bones.active = bone
-
-
-
-
-
+ arm.edit_bones.active = bone
+
+
+
+
+
diff --git a/rigify/rigs/pitchipoy/super_torso_turbo.py b/rigify/rigs/pitchipoy/super_torso_turbo.py
index e1ff5b0e..b6b70085 100644
--- a/rigify/rigs/pitchipoy/super_torso_turbo.py
+++ b/rigify/rigs/pitchipoy/super_torso_turbo.py
@@ -1,7 +1,7 @@
import bpy
from mathutils import Vector
from ...utils import copy_bone, flip_bone, put_bone, org
-from ...utils import strip_org, make_deformer_name, connected_children_names
+from ...utils import strip_org, make_deformer_name, connected_children_names
from ...utils import create_circle_widget, create_sphere_widget, create_widget
from ...utils import MetarigError, make_mechanism_name, create_cube_widget
from rna_prop_ui import rna_idprop_ui_prop_get
@@ -16,7 +16,7 @@ if is_selected( controls ):
"""
class Rig:
-
+
def __init__(self, obj, bone_name, params):
""" Initialize torso rig and key rig properties """
@@ -59,7 +59,7 @@ class Rig:
if len(self.org_bones) <= 4:
raise MetarigError(
"RIGIFY ERROR: invalid rig structure" % (strip_org(bone_name))
- )
+ )
def build_bone_structure( self ):
@@ -67,14 +67,14 @@ class Rig:
Neck --> Upper torso --> Lower torso --> Tail (optional) """
if self.pivot_pos and self.neck_pos:
-
+
neck_index = self.neck_pos - 1
pivot_index = self.pivot_pos - 1
tail_index = 0
if 'tail_pos' in dir(self):
tail_index = self.tail_pos - 1
-
+
neck_bones = self.org_bones[neck_index::]
upper_torso_bones = self.org_bones[pivot_index:neck_index]
lower_torso_bones = self.org_bones[tail_index:pivot_index]
@@ -85,8 +85,8 @@ class Rig:
return {
'neck' : neck_bones,
- 'upper' : upper_torso_bones,
- 'lower' : lower_torso_bones,
+ 'upper' : upper_torso_bones,
+ 'lower' : lower_torso_bones,
'tail' : tail_bones
}
@@ -95,13 +95,13 @@ class Rig:
def orient_bone( self, eb, axis, scale, reverse = False ):
v = Vector((0,0,0))
-
+
setattr(v,axis,scale)
if reverse:
tail_vec = v * self.obj.matrix_world
eb.head[:] = eb.tail
- eb.tail[:] = eb.head + tail_vec
+ eb.tail[:] = eb.head + tail_vec
else:
tail_vec = v * self.obj.matrix_world
eb.tail[:] = eb.head + tail_vec
@@ -114,19 +114,19 @@ class Rig:
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
- # Create torso control bone
+
+ # Create torso control bone
torso_name = 'torso'
ctrl_name = copy_bone(self.obj, pivot_name, torso_name)
ctrl_eb = eb[ ctrl_name ]
-
+
self.orient_bone( ctrl_eb, 'y', self.spine_length / 2.5 )
-
+
# Create mch_pivot
mch_name = make_mechanism_name( 'pivot' )
mch_name = copy_bone(self.obj, ctrl_name, mch_name)
mch_eb = eb[ mch_name ]
-
+
mch_eb.length /= 4
# Positioning pivot in a more usable location for animators
@@ -142,28 +142,28 @@ class Rig:
'mch' : mch_name
}
-
+
def create_deform( self ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
def_bones = []
for org in org_bones:
def_name = make_deformer_name( strip_org( org ) )
def_name = copy_bone( self.obj, org, def_name )
def_bones.append( def_name )
-
+
return def_bones
-
+
def create_neck( self, neck_bones ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# Create neck control
neck = copy_bone( self.obj, org(neck_bones[0]), 'neck' )
neck_eb = eb[ neck ]
@@ -179,14 +179,14 @@ class Rig:
mch_str = copy_bone( self.obj, neck, make_mechanism_name('STR-neck') )
# Neck MCH rotation
- mch_neck = copy_bone(
+ mch_neck = copy_bone(
self.obj, neck, make_mechanism_name('ROT-neck')
)
self.orient_bone( eb[mch_neck], 'y', self.spine_length / 10 )
# Head MCH rotation
- mch_head = copy_bone(
+ mch_head = copy_bone(
self.obj, head, make_mechanism_name('ROT-head')
)
@@ -204,8 +204,8 @@ class Rig:
# Tweak bones
for b in neck_bones[:-1]: # All except last bone
twk_name = "tweak_" + b
- twk_name = copy_bone( self.obj, org(b), twk_name )
-
+ twk_name = copy_bone( self.obj, org(b), twk_name )
+
eb[twk_name].length /= 2
twk += [ twk_name ]
@@ -223,25 +223,25 @@ class Rig:
def create_chest( self, chest_bones ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
# get total spine length
-
+
# Create chest control bone
chest = copy_bone( self.obj, org( chest_bones[0] ), 'chest' )
self.orient_bone( eb[chest], 'y', self.spine_length / 3 )
# create chest mch_wgt
- mch_wgt = copy_bone(
- self.obj, org( chest_bones[-1] ),
- make_mechanism_name( 'WGT-chest' )
+ mch_wgt = copy_bone(
+ self.obj, org( chest_bones[-1] ),
+ make_mechanism_name( 'WGT-chest' )
)
-
+
# Create mch and twk bones
twk,mch = [],[]
-
+
for b in chest_bones:
mch_name = copy_bone( self.obj, org(b), make_mechanism_name(b) )
self.orient_bone( eb[mch_name], 'y', self.spine_length / 10 )
@@ -263,36 +263,36 @@ class Rig:
def create_hips( self, hip_bones ):
org_bones = self.org_bones
-
+
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# Create hips control bone
hips = copy_bone( self.obj, org( hip_bones[-1] ), 'hips' )
- self.orient_bone(
- eb[hips],
- 'y',
- self.spine_length / 4,
- reverse = True
+ self.orient_bone(
+ eb[hips],
+ 'y',
+ self.spine_length / 4,
+ reverse = True
)
# create hips mch_wgt
- mch_wgt = copy_bone(
- self.obj, org( hip_bones[0] ),
- make_mechanism_name( 'WGT-hips' )
+ mch_wgt = copy_bone(
+ self.obj, org( hip_bones[0] ),
+ make_mechanism_name( 'WGT-hips' )
)
# Create mch and tweak bones
twk,mch = [],[]
for b in hip_bones:
mch_name = copy_bone( self.obj, org(b), make_mechanism_name(b) )
- self.orient_bone(
- eb[mch_name], 'y', self.spine_length / 10, reverse = True
+ self.orient_bone(
+ eb[mch_name], 'y', self.spine_length / 10, reverse = True
)
twk_name = "tweak_" + b
twk_name = copy_bone( self.obj, org( b ), twk_name )
-
+
eb[twk_name].length /= 2
mch += [ mch_name ]
@@ -315,13 +315,13 @@ class Rig:
bpy.ops.object.mode_set(mode ='EDIT')
eb = self.obj.data.edit_bones
-
+
# Parent deform bones
for i,b in enumerate( bones['def'] ):
if i > 0: # For all bones but the first (which has no parent)
eb[b].parent = eb[ bones['def'][i-1] ] # to previous
eb[b].use_connect = True
-
+
# Parent control bones
# Head control => MCH-rotation_head
eb[ bones['neck']['ctrl'] ].parent = eb[ bones['neck']['mch_head'] ]
@@ -343,7 +343,7 @@ class Rig:
parent = eb[ bones['neck']['mch_str'] ]
for i,b in enumerate([ eb[n] for n in bones['neck']['mch'] ]):
b.parent = parent
-
+
# Chest mch bones and neck mch
chest_mch = bones['chest']['mch'] + [ bones['neck']['mch_neck'] ]
for i,b in enumerate(chest_mch):
@@ -358,14 +358,14 @@ class Rig:
eb[b].parent = eb[ bones['pivot']['ctrl'] ]
else:
eb[b].parent = eb[ bones['hips']['mch'][i+1] ]
-
+
# mch pivot
eb[ bones['pivot']['mch'] ].parent = eb[ bones['chest']['mch'][0] ]
# MCH widgets
eb[ bones['chest']['mch_wgt'] ].parent = eb[ bones['chest']['mch'][-1] ]
eb[ bones['hips' ]['mch_wgt'] ].parent = eb[ bones['hips' ]['mch'][0 ] ]
-
+
# Tweaks
# Neck tweaks
@@ -374,14 +374,14 @@ class Rig:
eb[ twk ].parent = eb[ bones['neck']['ctrl_neck'] ]
else:
eb[ twk ].parent = eb[ bones['neck']['mch'][i-1] ]
-
+
# Chest tweaks
for twk,mch in zip( bones['chest']['tweak'], bones['chest']['mch'] ):
if bones['chest']['tweak'].index( twk ) == 0:
eb[ twk ].parent = eb[ bones['pivot']['mch'] ]
else:
eb[ twk ].parent = eb[ mch ]
-
+
# Hips tweaks
for i,twk in enumerate(bones['hips']['tweak']):
if i == 0:
@@ -408,7 +408,7 @@ class Rig:
const = owner_pb.constraints.new( constraint['constraint'] )
const.target = self.obj
- # filter contraint props to those that actually exist in the currnet
+ # filter contraint props to those that actually exist in the currnet
# type of constraint, then assign values to each
for p in [ k for k in constraint.keys() if k in dir(const) ]:
setattr( const, p, constraint[p] )
@@ -419,11 +419,11 @@ class Rig:
# head and neck MCH bones
for b in [ bones['neck']['mch_head'], bones['neck']['mch_neck'] ]:
- self.make_constraint( b, {
+ self.make_constraint( b, {
'constraint' : 'COPY_ROTATION',
'subtarget' : bones['pivot']['ctrl'],
} )
- self.make_constraint( b, {
+ self.make_constraint( b, {
'constraint' : 'COPY_SCALE',
'subtarget' : bones['pivot']['ctrl'],
} )
@@ -437,11 +437,11 @@ class Rig:
self.make_constraint( bones['neck']['mch_str'], {
'constraint' : 'STRETCH_TO',
'subtarget' : bones['neck']['ctrl'],
- })
-
+ })
+
# Intermediary mch bones
intermediaries = [ bones['neck'], bones['chest'], bones['hips'] ]
-
+
if 'tail' in bones.keys():
intermediaries += bones['tail']
@@ -452,21 +452,21 @@ class Rig:
for j,b in enumerate(mch):
if i == 0:
nfactor = float( (j + 1) / len( mch ) )
- self.make_constraint( b, {
+ self.make_constraint( b, {
'constraint' : 'COPY_ROTATION',
'subtarget' : l['ctrl'],
'influence' : nfactor
} )
else:
- self.make_constraint( b, {
+ self.make_constraint( b, {
'constraint' : 'COPY_TRANSFORMS',
'subtarget' : l['ctrl'],
'influence' : factor,
'owner_space' : 'LOCAL',
'target_space' : 'LOCAL'
- } )
+ } )
+
-
# MCH pivot
self.make_constraint( bones['pivot']['mch'], {
'constraint' : 'COPY_TRANSFORMS',
@@ -474,7 +474,7 @@ class Rig:
'owner_space' : 'LOCAL',
'target_space' : 'LOCAL'
})
-
+
# DEF bones
deform = bones['def']
tweaks = bones['hips']['tweak'] + bones['chest']['tweak']
@@ -509,13 +509,13 @@ class Rig:
def create_drivers( self, bones ):
bpy.ops.object.mode_set(mode ='OBJECT')
pb = self.obj.pose.bones
-
+
# Setting the torso's props
torso = pb[ bones['pivot']['ctrl'] ]
props = [ "head_follow", "neck_follow" ]
owners = [ bones['neck']['mch_head'], bones['neck']['mch_neck'] ]
-
+
for prop in props:
if prop == 'neck_follow':
torso[prop] = 0.5
@@ -528,13 +528,13 @@ class Rig:
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = prop
-
+
# driving the follow rotation switches for neck and head
for bone, prop, in zip( owners, props ):
# Add driver to copy rotation constraint
drv = pb[ bone ].constraints[ 0 ].driver_add("influence").driver
drv.type = 'AVERAGE'
-
+
var = drv.variables.new()
var.name = prop
var.type = "SINGLE_PROP"
@@ -543,13 +543,13 @@ class Rig:
torso.path_from_id() + '['+ '"' + prop + '"' + ']'
drv_modifier = self.obj.animation_data.drivers[-1].modifiers[0]
-
+
drv_modifier.mode = 'POLYNOMIAL'
drv_modifier.poly_order = 1
drv_modifier.coefficients[0] = 1.0
drv_modifier.coefficients[1] = -1.0
-
+
def locks_and_widgets( self, bones ):
bpy.ops.object.mode_set(mode ='OBJECT')
pb = self.obj.pose.bones
@@ -564,7 +564,7 @@ class Rig:
# Locks
tweaks = bones['neck']['tweak'] + bones['chest']['tweak']
tweaks += bones['hips']['tweak']
-
+
if 'tail' in bones.keys():
tweaks += bones['tail']['tweak']
@@ -577,39 +577,39 @@ class Rig:
# Assigning a widget to torso bone
create_cube_widget(
- self.obj,
- bones['pivot']['ctrl'],
- radius = 0.5,
+ self.obj,
+ bones['pivot']['ctrl'],
+ radius = 0.5,
bone_transform_name = None
)
-
+
# Assigning widgets to control bones
- gen_ctrls = [
- bones['neck']['ctrl_neck'],
+ gen_ctrls = [
+ bones['neck']['ctrl_neck'],
bones['chest']['ctrl'],
bones['hips']['ctrl']
]
-
+
if 'tail' in bones.keys():
gen_ctrls += [ bones['tail']['ctrl'] ]
-
+
for bone in gen_ctrls:
create_circle_widget(
- self.obj,
+ self.obj,
bone,
- radius = 1.0,
- head_tail = 0.5,
- with_line = False,
+ radius = 1.0,
+ head_tail = 0.5,
+ with_line = False,
bone_transform_name = None
)
# Head widget
create_circle_widget(
- self.obj,
- bones['neck']['ctrl'],
- radius = 0.75,
- head_tail = 1.0,
- with_line = False,
+ self.obj,
+ bones['neck']['ctrl'],
+ radius = 0.75,
+ head_tail = 1.0,
+ with_line = False,
bone_transform_name = None
)
@@ -617,7 +617,7 @@ class Rig:
chest_widget_loc = pb[ bones['chest']['mch_wgt'] ]
pb[ bones['chest']['ctrl'] ].custom_shape_transform = chest_widget_loc
- hips_widget_loc = pb[ bones['hips']['mch_wgt'] ]
+ hips_widget_loc = pb[ bones['hips']['mch_wgt'] ]
if 'tail' in bones.keys():
hips_widget_loc = bones['def'][self.tail_pos -1]
@@ -626,13 +626,13 @@ class Rig:
# Assigning widgets to tweak bones and layers
for bone in tweaks:
create_sphere_widget(self.obj, bone, bone_transform_name=None)
-
+
if self.tweak_layers:
- pb[bone].bone.layers = self.tweak_layers
+ pb[bone].bone.layers = self.tweak_layers
def generate( self ):
-
+
# Torso Rig Anatomy:
# Neck: all bones above neck point, last bone is head
# Upper torso: all bones between pivot and neck start
@@ -682,15 +682,15 @@ class Rig:
controls = [ bones['neck']['ctrl'], bones['neck']['ctrl_neck'] ]
controls += [ bones['chest']['ctrl'], bones['hips']['ctrl'] ]
controls += [ bones['pivot']['ctrl'] ]
-
+
if 'tail' in bones.keys():
controls += [ bones['tail']['ctrl'] ]
# Create UI
controls_string = ", ".join(["'" + x + "'" for x in controls])
return [script % (
- controls_string,
- bones['pivot']['ctrl'],
+ controls_string,
+ bones['pivot']['ctrl'],
'head_follow',
'neck_follow'
)]
@@ -721,9 +721,9 @@ def add_parameters( params ):
)
# Setting up extra layers for the FK and tweak
- params.tweak_extra_layers = bpy.props.BoolProperty(
- name = "tweak_extra_layers",
- default = True,
+ params.tweak_extra_layers = bpy.props.BoolProperty(
+ name = "tweak_extra_layers",
+ default = True,
description = ""
)
@@ -736,7 +736,7 @@ def add_parameters( params ):
def parameters_ui(layout, params):
""" Create the ui for the rig parameters."""
-
+
r = layout.row()
r.prop(params, "neck_pos")
@@ -749,7 +749,7 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "tweak_extra_layers")
r.active = params.tweak_extra_layers
-
+
col = r.column(align=True)
row = col.row(align=True)
@@ -785,7 +785,7 @@ def create_sample(obj):
bone.roll = 0.0000
bone.use_connect = False
bones['spine'] = bone.name
-
+
bone = arm.edit_bones.new('spine.001')
bone.head[:] = 0.0000, 0.0172, 1.1573
bone.tail[:] = 0.0000, 0.0004, 1.2929
@@ -793,7 +793,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine']]
bones['spine.001'] = bone.name
-
+
bone = arm.edit_bones.new('spine.002')
bone.head[:] = 0.0000, 0.0004, 1.2929
bone.tail[:] = 0.0000, 0.0059, 1.4657
@@ -801,7 +801,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine.001']]
bones['spine.002'] = bone.name
-
+
bone = arm.edit_bones.new('spine.003')
bone.head[:] = 0.0000, 0.0059, 1.4657
bone.tail[:] = 0.0000, 0.0114, 1.6582
@@ -809,7 +809,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine.002']]
bones['spine.003'] = bone.name
-
+
bone = arm.edit_bones.new('spine.004')
bone.head[:] = 0.0000, 0.0114, 1.6582
bone.tail[:] = 0.0000, -0.0067, 1.7197
@@ -817,7 +817,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine.003']]
bones['spine.004'] = bone.name
-
+
bone = arm.edit_bones.new('spine.005')
bone.head[:] = 0.0000, -0.0067, 1.7197
bone.tail[:] = 0.0000, -0.0247, 1.7813
@@ -825,7 +825,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine.004']]
bones['spine.005'] = bone.name
-
+
bone = arm.edit_bones.new('spine.006')
bone.head[:] = 0.0000, -0.0247, 1.7813
bone.tail[:] = 0.0000, -0.0247, 1.9796
@@ -833,7 +833,7 @@ def create_sample(obj):
bone.use_connect = True
bone.parent = arm.edit_bones[bones['spine.005']]
bones['spine.006'] = bone.name
-
+
bpy.ops.object.mode_set(mode='OBJECT')
pbone = obj.pose.bones[bones['spine']]
diff --git a/rigify/rigs/pitchipoy/super_widgets.py b/rigify/rigs/pitchipoy/super_widgets.py
index aee6c14e..8930ba91 100644
--- a/rigify/rigs/pitchipoy/super_widgets.py
+++ b/rigify/rigs/pitchipoy/super_widgets.py
@@ -43,7 +43,7 @@ def create_ear_widget(rig, bone_name, size=1.0, bone_transform_name=None):
verts = [(-2.4903741291382175e-09*size, 1.0*size, -3.123863123732917e-08*size), (-7.450580596923828e-09*size, 0.9829629063606262*size, 0.0776456817984581*size), (-1.4901161193847656e-08*size, 0.9330127239227295*size, 0.1499999761581421*size), (-2.9802322387695312e-08*size, 0.8535534143447876*size, 0.2121320217847824*size), (-2.9802322387695312e-08*size, 0.75*size, 0.25980761647224426*size), (-2.9802322387695312e-08*size, 0.6294095516204834*size, 0.2897777259349823*size), (-2.9802322387695312e-08*size, 0.5000000596046448*size, 0.29999998211860657*size), (-5.960464477539063e-08*size, 0.37059056758880615*size, 0.2897777855396271*size), (-5.960464477539063e-08*size, 0.25000008940696716*size, 0.25980767607688904*size), (-4.470348358154297e-08*size, 0.14644670486450195*size, 0.21213211119174957*size), (-4.470348358154297e-08*size, 0.06698736548423767*size, 0.15000009536743164*size), (-4.470348358154297e-08*size, 0.017037123441696167*size, 0.07764581590890884*size), (-3.6718930118695425e-08*size, 0.0*size, 1.1981423142515268e-07*size), (-2.9802322387695312e-08*size, 0.017037034034729004*size, -0.07764559239149094*size), (-2.9802322387695312e-08*size, 0.06698718667030334*size, -0.14999987185001373*size), (-1.4901161193847656e-08*size, 0.14644640684127808*size, -0.21213191747665405*size), (0.0*size, 0.24999985098838806*size, -0.25980761647224426*size), (0.0*size, 0.3705902695655823*size, -0.2897777259349823*size), (0.0*size, 0.4999997615814209*size, -0.30000004172325134*size), (0.0*size, 0.6294092535972595*size, -0.2897777855396271*size), (0.0*size, 0.7499997615814209*size, -0.2598077356815338*size), (1.4901161193847656e-08*size, 0.8535531759262085*size, -0.21213220059871674*size), (0.0*size, 0.9330125451087952*size, -0.15000019967556*size), (0.0*size, 0.9829628467559814*size, -0.07764596492052078*size), ]
edges = [(1, 0), (2, 1), (3, 2), (4, 3), (5, 4), (6, 5), (7, 6), (8, 7), (9, 8), (10, 9), (11, 10), (12, 11), (13, 12), (14, 13), (15, 14), (16, 15), (17, 16), (18, 17), (19, 18), (20, 19), (21, 20), (22, 21), (23, 22), (0, 23), ]
faces = []
-
+
mesh = obj.data
mesh.from_pydata(verts, edges, faces)
mesh.update()
@@ -58,7 +58,7 @@ def create_jaw_widget(rig, bone_name, size=1.0, bone_transform_name=None):
verts = [(0.606898307800293*size, 0.6533132195472717*size, 0.09324522316455841*size), (0.5728408694267273*size, 0.7130533456802368*size, 0.04735109210014343*size), (0.478340744972229*size, 0.856249213218689*size, 0.0167550016194582*size), (0.3405401408672333*size, 1.0092359781265259*size, 0.003642391413450241*size), (0.1764744222164154*size, 1.1159402132034302*size, 0.0003642391529865563*size), (0.5728408694267273*size, 0.7130533456802368*size, 0.1391393542289734*size), (0.478340744972229*size, 0.856249213218689*size, 0.16973544657230377*size), (0.3405401408672333*size, 1.0092359781265259*size, 0.18284805119037628*size), (0.1764744222164154*size, 1.1159402132034302*size, 0.1861262023448944*size), (0.0*size, 1.153113603591919*size, 0.0*size), (-0.606898307800293*size, 0.6533132195472717*size, 0.09324522316455841*size), (-0.5728408694267273*size, 0.7130533456802368*size, 0.04735109210014343*size), (-0.478340744972229*size, 0.856249213218689*size, 0.0167550016194582*size), (-0.3405401408672333*size, 1.0092359781265259*size, 0.003642391413450241*size), (-0.1764744222164154*size, 1.1159402132034302*size, 0.0003642391529865563*size), (0.0*size, 1.153113603591919*size, 0.18649044632911682*size), (-0.5728408694267273*size, 0.7130533456802368*size, 0.1391393542289734*size), (-0.478340744972229*size, 0.856249213218689*size, 0.16973544657230377*size), (-0.3405401408672333*size, 1.0092359781265259*size, 0.18284805119037628*size), (-0.1764744222164154*size, 1.1159402132034302*size, 0.1861262023448944*size), ]
edges = [(1, 0), (2, 1), (3, 2), (4, 3), (9, 4), (6, 5), (7, 6), (8, 7), (15, 8), (5, 0), (11, 10), (12, 11), (13, 12), (14, 13), (9, 14), (17, 16), (18, 17), (19, 18), (15, 19), (16, 10), ]
faces = []
-
+
mesh = obj.data
mesh.from_pydata(verts, edges, faces)
mesh.update()
@@ -66,21 +66,21 @@ def create_jaw_widget(rig, bone_name, size=1.0, bone_transform_name=None):
else:
return None
-
+
def create_teeth_widget(rig, bone_name, size=1.0, bone_transform_name=None):
obj = create_widget(rig, bone_name, bone_transform_name)
if obj is not None:
verts = [(0.6314387321472168*size, 0.4999997019767761*size, 0.09999999403953552*size), (0.5394065976142883*size, 0.29289281368255615*size, 0.09999999403953552*size), (0.3887903690338135*size, 0.1339743733406067*size, 0.09999999403953552*size), (0.19801488518714905*size, 0.03407406806945801*size, 0.09999999403953552*size), (-3.4034394502668874e-07*size, 0.0*size, 0.09999999403953552*size), (-0.19801555573940277*size, 0.034074246883392334*size, 0.09999999403953552*size), (-0.7000000476837158*size, 1.0000001192092896*size, -0.10000000894069672*size), (-0.6778771877288818*size, 0.7411810755729675*size, -0.10000000894069672*size), (-0.6314389705657959*size, 0.5000001192092896*size, -0.10000000894069672*size), (-0.5394070148468018*size, 0.2928934097290039*size, -0.10000000894069672*size), (-0.38879096508026123*size, 0.13397473096847534*size, -0.10000000894069672*size), (-0.19801555573940277*size, 0.034074246883392334*size, -0.10000000894069672*size), (-3.4034394502668874e-07*size, 0.0*size, -0.10000000894069672*size), (0.19801488518714905*size, 0.03407406806945801*size, -0.10000000894069672*size), (0.3887903690338135*size, 0.1339743733406067*size, -0.10000000894069672*size), (0.5394065976142883*size, 0.29289281368255615*size, -0.10000000894069672*size), (0.6314387321472168*size, 0.4999997019767761*size, -0.10000000894069672*size), (0.6778769493103027*size, 0.7411805391311646*size, -0.10000000894069672*size), (0.6999999284744263*size, 0.9999995231628418*size, -0.10000000894069672*size), (-0.38879096508026123*size, 0.13397473096847534*size, 0.09999999403953552*size), (-0.5394070148468018*size, 0.2928934097290039*size, 0.09999999403953552*size), (-0.6314389705657959*size, 0.5000001192092896*size, 0.09999999403953552*size), (-0.6778771877288818*size, 0.7411810755729675*size, 0.09999999403953552*size), (-0.7000000476837158*size, 1.0000001192092896*size, 0.09999999403953552*size), (0.6778769493103027*size, 0.7411805391311646*size, 0.09999999403953552*size), (0.6999999284744263*size, 0.9999995231628418*size, 0.09999999403953552*size), ]
edges = [(25, 24), (24, 0), (0, 1), (1, 2), (2, 3), (3, 4), (7, 6), (8, 7), (9, 8), (10, 9), (11, 10), (12, 11), (13, 12), (14, 13), (15, 14), (16, 15), (17, 16), (18, 17), (4, 5), (5, 19), (19, 20), (20, 21), (21, 22), (22, 23), (18, 25), (6, 23), ]
faces = []
-
+
mesh = obj.data
mesh.from_pydata(verts, edges, faces)
mesh.update()
return obj
else:
return None
-
+
def create_face_widget(rig, bone_name, size=1.0, bone_transform_name=None):
obj = create_widget(rig, bone_name, bone_transform_name)
if obj is not None:
@@ -132,7 +132,7 @@ def create_hand_widget(rig, bone_name, size=1.0, bone_transform_name=None):
def create_foot_widget(rig, bone_name, size=1.0, bone_transform_name=None):
# Create hand widget
obj = create_widget(rig, bone_name, bone_transform_name)
- if obj is not None:
+ if obj is not None:
verts = [(-0.6999998688697815*size, -0.5242648720741272*size, 0.0*size), (-0.7000001072883606*size, 1.2257349491119385*size, 0.0*size), (0.6999998688697815*size, 1.2257351875305176*size, 0.0*size), (0.7000001072883606*size, -0.5242648720741272*size, 0.0*size), (-0.6999998688697815*size, 0.2527350187301636*size, 0.0*size), (0.7000001072883606*size, 0.2527352571487427*size, 0.0*size), (-0.7000001072883606*size, 0.975735068321228*size, 0.0*size), (0.6999998688697815*size, 0.9757352471351624*size, 0.0*size), ]
edges = [(1, 2), (0, 3), (0, 4), (3, 5), (4, 6), (1, 6), (5, 7), (2, 7), ]
faces = []
@@ -153,7 +153,7 @@ def create_ballsocket_widget(rig, bone_name, size=1.0, bone_transform_name=None)
verts = [(-0.050000108778476715*size, 0.779460072517395*size, -0.2224801927804947*size), (0.049999915063381195*size, 0.779460072517395*size, -0.22248023748397827*size), (0.09999985247850418*size, 0.6790841817855835*size, -0.3658318817615509*size), (-2.3089636158601934e-07*size, 0.5930476188659668*size, -0.488704651594162*size), (-0.10000013560056686*size, 0.6790841817855835*size, -0.3658317029476166*size), (0.04999981075525284*size, 0.6790841817855835*size, -0.36583182215690613*size), (-0.050000183284282684*size, 0.6790841817855835*size, -0.3658318519592285*size), (-0.3658319115638733*size, 0.6790841221809387*size, 0.05000019446015358*size), (-0.3658318817615509*size, 0.6790841221809387*size, -0.04999979957938194*size), (-0.36583176255226135*size, 0.6790841221809387*size, 0.10000018030405045*size), (-0.48870471119880676*size, 0.5930476188659668*size, 2.4472291215715813e-07*size), (-0.3658319413661957*size, 0.679084062576294*size, -0.0999998077750206*size), (-0.22248037159442902*size, 0.7794600129127502*size, -0.04999985918402672*size), (-0.22248034179210663*size, 0.7794600129127502*size, 0.05000016465783119*size), (0.3658319115638733*size, 0.6790841221809387*size, -0.05000000819563866*size), (0.3658319115638733*size, 0.6790841221809387*size, 0.05000000074505806*size), (0.36583179235458374*size, 0.6790841221809387*size, -0.09999998658895493*size), (0.4887046813964844*size, 0.5930476188659668*size, -3.8399143420519977e-08*size), (0.3658319413661957*size, 0.679084062576294*size, 0.10000000149011612*size), (0.050000034272670746*size, 0.7794599533081055*size, 0.2224804311990738*size), (-0.04999997466802597*size, 0.7794599533081055*size, 0.2224804311990738*size), (-0.09999992698431015*size, 0.679084062576294*size, 0.36583200097084045*size), (1.267315070663244e-07*size, 0.5930474996566772*size, 0.48870477080345154*size), (0.1000000610947609*size, 0.679084062576294*size, 0.3658318519592285*size), (-0.049999915063381195*size, 0.679084062576294*size, 0.3658319413661957*size), (0.05000007897615433*size, 0.679084062576294*size, 0.36583197116851807*size), (0.22248029708862305*size, 0.7794600129127502*size, 0.05000004544854164*size), (0.22248028218746185*size, 0.7794600129127502*size, -0.04999994859099388*size), (-4.752442350763886e-08*size, 0.8284152746200562*size, -0.1499999612569809*size), (-0.03882290795445442*size, 0.8284152746200562*size, -0.14488883316516876*size), (-0.07500004768371582*size, 0.8284152746200562*size, -0.12990377843379974*size), (-0.10606606304645538*size, 0.8284152746200562*size, -0.10606598109006882*size), (-0.1299038827419281*size, 0.8284152746200562*size, -0.07499996572732925*size), (-0.14488893747329712*size, 0.8284152746200562*size, -0.038822825998067856*size), (-0.15000006556510925*size, 0.8284152746200562*size, 2.4781975582754967e-08*size), (-0.1448889672756195*size, 0.8284152746200562*size, 0.038822878152132034*size), (-0.1299038827419281*size, 0.8284152746200562*size, 0.07500001043081284*size), (-0.10606609284877777*size, 0.8284152746200562*size, 0.1060660257935524*size), (-0.0750000923871994*size, 0.8284152746200562*size, 0.12990383803844452*size), (-0.038822952657938004*size, 0.8284152746200562*size, 0.14488889276981354*size), (-1.0593657862045802e-07*size, 0.8284152746200562*size, 0.15000005066394806*size), (0.03882275149226189*size, 0.8284152746200562*size, 0.14488892257213593*size), (0.07499989867210388*size, 0.8284152746200562*size, 0.1299038976430893*size), (0.10606591403484344*size, 0.8284152746200562*size, 0.10606611520051956*size), (0.12990373373031616*size, 0.8284152746200562*size, 0.0750000849366188*size), (0.14488881826400757*size, 0.8284152746200562*size, 0.038822952657938004*size), (0.1499999463558197*size, 0.8284152746200562*size, 1.0584351883835552e-07*size), (0.14488881826400757*size, 0.8284152746200562*size, -0.03882275149226189*size), (0.12990379333496094*size, 0.8284152746200562*size, -0.07499989122152328*size), (0.10606604814529419*size, 0.8284152746200562*size, -0.10606592148542404*size), (0.07500004768371582*size, 0.8284152746200562*size, -0.12990371882915497*size), (0.03882291540503502*size, 0.8284152746200562*size, -0.14488880336284637*size), ]
edges = [(1, 0), (3, 2), (5, 2), (4, 3), (6, 4), (1, 5), (0, 6), (13, 7), (12, 8), (7, 9), (9, 10), (8, 11), (27, 14), (26, 15), (14, 16), (16, 17), (15, 18), (17, 18), (10, 11), (12, 13), (20, 19), (22, 21), (24, 21), (23, 22), (29, 28), (30, 29), (31, 30), (32, 31), (33, 32), (34, 33), (35, 34), (36, 35), (37, 36), (38, 37), (39, 38), (40, 39), (41, 40), (42, 41), (43, 42), (44, 43), (45, 44), (46, 45), (47, 46), (48, 47), (49, 48), (50, 49), (51, 50), (28, 51), (26, 27), (25, 23), (20, 24), (19, 25), ]
faces = []
-
+
mesh = obj.data
mesh.from_pydata(verts, edges, faces)
mesh.update()
diff --git a/rigify/rigs/pitchipoy/tentacle.py b/rigify/rigs/pitchipoy/tentacle.py
index b8d52e88..0d24be16 100644
--- a/rigify/rigs/pitchipoy/tentacle.py
+++ b/rigify/rigs/pitchipoy/tentacle.py
@@ -16,17 +16,17 @@ if is_selected( controls ):
"""
class Rig:
-
+
def __init__(self, obj, bone_name, params):
self.obj = obj
self.org_bones = [bone_name] + connected_children_names(obj, bone_name)
self.params = params
-
+
if params.tweak_extra_layers:
self.tweak_layers = list( params.tweak_layers )
else:
self.tweak_layers = None
-
+
if len(self.org_bones) <= 1:
raise MetarigError(
"RIGIFY ERROR: invalid rig structure" % (strip_org(bone_name))
@@ -39,49 +39,49 @@ class Rig:
org_bones = self.org_bones
mch_parent = self.obj.data.bones[ org_bones[0] ].parent
-
+
mch_parent_name = mch_parent.name # Storing the mch parent's name
-
+
if not mch_parent:
mch_parent = self.obj.data.edit_bones[ org_bones[0] ]
mch_bone = copy_bone(
- self.obj,
+ self.obj,
mch_parent_name,
make_mechanism_name( strip_org( org_bones[0] ) )
)
else:
mch_bone = copy_bone(
- self.obj,
+ self.obj,
mch_parent_name,
make_mechanism_name( strip_org( org_bones[0] ) )
- )
-
+ )
+
put_bone( self.obj, mch_bone, eb[ mch_parent_name ].tail )
-
+
eb[ mch_bone ].length /= 4 # reduce length to fourth of original
-
+
return mch_bone
-
+
def make_master( self ):
bpy.ops.object.mode_set(mode ='EDIT')
org_bones = self.org_bones
-
+
master_bone = copy_bone(
- self.obj,
- org_bones[0],
+ self.obj,
+ org_bones[0],
"master_" + strip_org( org_bones[0] )
- )
+ )
# Make widgets
- bpy.ops.object.mode_set(mode ='OBJECT')
+ bpy.ops.object.mode_set(mode ='OBJECT')
create_square_widget( self.obj, master_bone )
-
+
return master_bone
-
+
def make_controls( self ):
bpy.ops.object.mode_set(mode ='EDIT')
@@ -92,8 +92,8 @@ class Rig:
name = org_bones[i]
ctrl_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
strip_org(name)
)
@@ -104,7 +104,7 @@ class Rig:
for ctrl in ctrl_chain:
create_circle_widget(self.obj, ctrl, radius=0.3, head_tail=0.5)
-
+
return ctrl_chain
@@ -122,19 +122,19 @@ class Rig:
name = org_bones[i]
tweak_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
"tweak_" + strip_org(name)
)
tweak_e = eb[ tweak_bone ]
-
+
tweak_e.length /= 2 # Set size to half
-
+
if i == len( org_bones ):
# Position final tweak at the tip
put_bone( self.obj, tweak_bone, eb[ org_bones[-1]].tail )
-
+
tweak_chain.append( tweak_bone )
# Make widgets
@@ -157,8 +157,8 @@ class Rig:
# Set up tweak bone layers
if self.tweak_layers:
tweak_pb.bone.layers = self.tweak_layers
-
- return tweak_chain
+
+ return tweak_chain
def make_deform( self ):
@@ -171,13 +171,13 @@ class Rig:
name = org_bones[i]
def_bone = copy_bone(
- self.obj,
- name,
+ self.obj,
+ name,
make_deformer_name(strip_org(name))
)
def_chain.append( def_bone )
-
+
return def_chain
@@ -207,7 +207,7 @@ class Rig:
for bone in ctrls_n_parent[1:]:
previous_index = ctrls_n_parent.index( bone ) - 1
eb[ bone ].parent = eb[ ctrls_n_parent[previous_index] ]
-
+
# Parent tweak bones
tweaks = all_bones['tweak']
for tweak in all_bones['tweak']:
@@ -216,7 +216,7 @@ class Rig:
parent = all_bones['control'][ -1 ]
else:
parent = all_bones['control'][ tweaks.index( tweak ) ]
-
+
eb[ tweak ].parent = eb[ parent ]
# Parent deform bones
@@ -228,15 +228,15 @@ class Rig:
# Parent org bones ( to tweaks by default, or to the controls )
for org, tweak in zip( org_bones, all_bones['tweak'] ):
- eb[ org ].parent = eb[ tweak ]
-
-
+ eb[ org ].parent = eb[ tweak ]
+
+
def make_constraints( self, all_bones ):
bpy.ops.object.mode_set(mode ='OBJECT')
org_bones = self.org_bones
pb = self.obj.pose.bones
-
+
## MCH bone constraints
if pb[ org_bones[0] ].parent:
mch_pb = pb[ all_bones['mch'] ]
@@ -249,37 +249,37 @@ class Rig:
con = mch_pb.constraints.new('COPY_ROTATION')
con.target = self.obj
con.subtarget = pb[ org_bones[0] ].parent.name
-
+
con = mch_pb.constraints.new('COPY_SCALE')
con.target = self.obj
con.subtarget = pb[ org_bones[0] ].parent.name
- """
+ """
# Setting the MCH prop
master_pb = pb[ all_bones['master'] ]
prop_name_r = "rotation_follow"
prop_name_s = "scale_follow"
-
+
prop_names = [ prop_name_r, prop_name_s ]
-
+
for prop_name in prop_names:
master_pb[prop_name] = 1.0
-
+
prop = rna_idprop_ui_prop_get( master_pb, prop_name )
prop["min"] = 0.0
prop["max"] = 1.0
prop["soft_min"] = 0.0
prop["soft_max"] = 1.0
prop["description"] = prop_name
-
+
# driving the MCH follow rotation switch
- drv = mch_pb.constraints[
- prop_names.index(prop_name) +1
+ drv = mch_pb.constraints[
+ prop_names.index(prop_name) +1
].driver_add("influence").driver
-
+
drv.type='SUM'
-
+
var = drv.variables.new()
var.name = prop_name
var.type = "SINGLE_PROP"
@@ -298,15 +298,15 @@ class Rig:
con = pb[deform].constraints.new('COPY_TRANSFORMS')
con.target = self.obj
con.subtarget = tweak
-
+
con = pb[deform].constraints.new('DAMPED_TRACK')
con.target = self.obj
con.subtarget = tweaks[ tweaks.index( tweak ) + 1 ]
-
+
con = pb[deform].constraints.new('STRETCH_TO')
con.target = self.obj
con.subtarget = tweaks[ tweaks.index( tweak ) + 1 ]
-
+
## Control bones' constraints
if self.params.make_rotations:
if ctrl != ctrls[0]:
@@ -316,7 +316,7 @@ class Rig:
con.use_offset = True
con.target_space = 'LOCAL'
con.owner_space = 'LOCAL'
-
+
def generate(self):
bpy.ops.object.mode_set(mode ='EDIT')
@@ -326,7 +326,7 @@ class Rig:
for bone in self.org_bones:
# eb[ bone ].parent = None
eb[ bone ].use_connect = False
-
+
# Creating all bones
mch = self.make_mch()
# master = self.make_master()
@@ -341,7 +341,7 @@ class Rig:
'tweak' : tweak_chain,
'deform' : def_chain
}
-
+
self.make_constraints( all_bones )
self.parent_bones( all_bones )
@@ -350,7 +350,7 @@ class Rig:
all_controls = all_bones['control'] + all_bones['tweak'] # + [ all_bones['master'] ]
controls_string = ", ".join(["'" + x + "'" for x in all_controls])
return [script % (
- controls_string,
+ controls_string,
'rotation_follow',
'scale_follow'
)]
@@ -361,14 +361,14 @@ def add_parameters(params):
RigifyParameters PropertyGroup
"""
params.make_rotations = bpy.props.BoolProperty(
- name = "Rotations",
- default = True,
+ name = "Rotations",
+ default = True,
description = "Make bones follow parent rotation"
)
# Setting up extra tweak layers
- params.tweak_extra_layers = bpy.props.BoolProperty(
- name = "tweak_extra_layers",
+ params.tweak_extra_layers = bpy.props.BoolProperty(
+ name = "tweak_extra_layers",
default = True,
description = ""
)
@@ -390,7 +390,7 @@ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "tweak_extra_layers")
r.active = params.tweak_extra_layers
-
+
col = r.column(align=True)
row = col.row(align=True)
@@ -400,28 +400,28 @@ def parameters_ui(layout, params):
row = col.row(align=True)
for i in range( 16, 24 ): # Layers 16-23
- row.prop(params, "tweak_layers", index=i, toggle=True, text="")
-
+ row.prop(params, "tweak_layers", index=i, toggle=True, text="")
+
col = r.column(align=True)
row = col.row(align=True)
for i in range( 8, 16 ): # Layers 8-15
- row.prop(params, "tweak_layers", index=i, toggle=True, text="")
+ row.prop(params, "tweak_layers", index=i, toggle=True, text="")
row = col.row(align=True)
for i in range( 24, 32 ): # Layers 24-31
- row.prop(params, "tweak_layers", index=i, toggle=True, text="")
+ row.prop(params, "tweak_layers", index=i, toggle=True, text="")
def create_square_widget(rig, bone_name, size=1.0, bone_transform_name=None):
obj = create_widget(rig, bone_name, bone_transform_name)
if obj is not None:
verts = [
- ( 0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
- ( -0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
- ( 0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
- ( -0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
+ ( 0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
+ ( -0.5 * size, -2.9802322387695312e-08 * size, 0.5 * size ),
+ ( 0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
+ ( -0.5 * size, 2.9802322387695312e-08 * size, -0.5 * size ),
]
edges = [(0, 1), (2, 3), (0, 2), (3, 1) ]
@@ -435,7 +435,7 @@ def create_square_widget(rig, bone_name, size=1.0, bone_transform_name=None):
else:
return None
-def create_sample(obj):
+def create_sample(obj):
# generated by rigify.utils.write_metarig
bpy.ops.object.mode_set(mode='EDIT')
diff --git a/rigify/ui.py b/rigify/ui.py
index bcd8b7be..dec5b73c 100644
--- a/rigify/ui.py
+++ b/rigify/ui.py
@@ -128,7 +128,7 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel):
split.prop(rigify_layer, "name", text="Layer %d" % (i + 1))
split.prop(rigify_layer, "row", text="")
- #split.prop(rigify_layer, "column", text="")
+ #split.prop(rigify_layer, "column", text="")
class BONE_PT_rigify_buttons(bpy.types.Panel):
diff --git a/rigify/utils.py b/rigify/utils.py
index 1531403f..dc9897ac 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -151,7 +151,7 @@ def copy_bone_simple(obj, bone_name, assign_name=''):
edit_bone_1 = obj.data.edit_bones[bone_name]
edit_bone_2 = obj.data.edit_bones.new(assign_name)
bone_name_1 = bone_name
- bone_name_2 = edit_bone_2.name
+ bone_name_2 = edit_bone_2.name
# Copy edit bone attributes
edit_bone_2.layers = list(edit_bone_1.layers)
diff --git a/system_blend_info.py b/system_blend_info.py
index ca67bb5b..8b2a0939 100644
--- a/system_blend_info.py
+++ b/system_blend_info.py
@@ -70,7 +70,7 @@ class OBJECT_PT_blendinfo(bpy.types.Panel):
objects = bpy.data.objects
layout = self.layout
-
+
# OBJECTS
l_row = layout.row()
@@ -132,7 +132,7 @@ class OBJECT_PT_blendinfo(bpy.types.Panel):
icon='OUTLINER_OB_SPEAKER')
layout.separator()
-
+
# DATABLOCKS
l_row = layout.row()
diff --git a/ui_layer_manager.py b/ui_layer_manager.py
index a1722b7a..7367cce3 100644
--- a/ui_layer_manager.py
+++ b/ui_layer_manager.py
@@ -554,9 +554,9 @@ def update_panel(self, context):
except:
pass
SCENE_PT_namedlayer_layers.bl_category = context.user_preferences.addons[__name__].preferences.category
- bpy.utils.register_class(SCENE_PT_namedlayer_layers)
+ bpy.utils.register_class(SCENE_PT_namedlayer_layers)
SCENE_PT_namedlayer_groups.bl_category = context.user_preferences.addons[__name__].preferences.category
- bpy.utils.register_class(SCENE_PT_namedlayer_groups)
+ bpy.utils.register_class(SCENE_PT_namedlayer_groups)
class LayerMAddonPreferences(bpy.types.AddonPreferences):
# this must match the addon name, use '__package__'