Commit 666c4b77 authored by Campbell Barton's avatar Campbell Barton
Browse files

Cleanup: trailing space

parent a49080ad
......@@ -1524,7 +1524,7 @@ def createCurve(vertArray, self, align_matrix):
# set curveOptions
newCurve.dimensions = '2D'
newCurve.fill_mode = 'BOTH'
newCurve.fill_mode = 'BOTH'
newSpline.use_cyclic_u = True
newSpline.use_endpoint_u = True
......@@ -1915,7 +1915,7 @@ def main(self, align_matrix):
if self.Angle_Type == 'C':
b = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
a = ablength(0, self.Dimension_startlocation.y, self.Dimension_startlocation.z, 0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z)
c = ablength(0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
c = ablength(0, self.Dimension_endanglelocation.y, self.Dimension_endanglelocation.z, 0, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
if self.Dimension_liberty == '3D':
if self.Angle_Type == 'A':
c = ablength(self.Dimension_startlocation.x, self.Dimension_startlocation.y, self.Dimension_startlocation.z, self.Dimension_endlocation.x, self.Dimension_endlocation.y, self.Dimension_endlocation.z)
......@@ -2063,7 +2063,7 @@ class Dimension(bpy.types.Operator):
bl_label = "Dimension"
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
bl_description = "add dimension"
#settings : bpy.props.PointerProperty(type=DimensionVariables)
# align_matrix for the invoke
......@@ -2586,10 +2586,10 @@ def StartLocationUpdate(self, context):
# ### MENU append ###
def Dimension_object_menu(self, context):
bl_label = 'Dimension'
obj = context.object
layout = self.layout
if 'Dimension' in obj.keys():
props = layout.operator("curve.dimension", text="Change Dimension")
props.Dimension_Change = True
......@@ -2822,10 +2822,10 @@ def Dimension_object_menu(self, context):
def Dimension_edit_menu(self, context):
bl_label = 'Dimension'
obj = context.object
layout = self.layout
vertex = []
for i in obj.data.vertices :
if i.select :
......@@ -3034,7 +3034,7 @@ def unregister():
bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(Dimension_edit_menu)
bpy.types.VIEW3D_MT_object_context_menu.remove(Dimension_object_menu)
bpy.types.VIEW3D_MT_curve_add.remove(Dimension_button)
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
......
......@@ -302,12 +302,12 @@ def DEF_atom_draw_atoms(prop_element,
color = (1.0, 0.81, 0.13, 1.0)
radii = [1.34]
# First, we create a collection for the atoms, which includes the
# First, we create a collection for the atoms, which includes the
# representative ball and the mesh.
coll_atom_name = "Cluster (" + coll_name + ")_" + name.lower()
# Create the new collection and ...
coll_atom = bpy.data.collections.new(coll_atom_name)
# ... link it to the collection, which contains all parts of the
# ... link it to the collection, which contains all parts of the
# element (ball and mesh).
bpy.data.collections.new(coll_atom_name)
bpy.context.scene.collection.children.link(coll_atom)
......@@ -354,7 +354,7 @@ def DEF_atom_draw_atoms(prop_element,
coll_past = coll_all[0]
else:
coll_past = bpy.context.scene.collection
# Put the atom into the new collection 'atom' and ...
coll_atom.objects.link(ball)
# ... unlink the atom from the other collection.
......@@ -374,26 +374,26 @@ def DEF_menu_func(self, context):
self.layout.operator(CLASS_ImportCluster.bl_idname, icon='PLUGIN')
classes = (CLASS_ImportCluster,
CLASS_PT_atom_cluster_panel,
CLASS_atom_cluster_Properties,
classes = (CLASS_ImportCluster,
CLASS_PT_atom_cluster_panel,
CLASS_atom_cluster_Properties,
CLASS_atom_cluster_load_button)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.atom_cluster = bpy.props.PointerProperty(type=
CLASS_atom_cluster_Properties)
bpy.types.VIEW3D_MT_mesh_add.append(DEF_menu_func)
def unregister():
bpy.types.VIEW3D_MT_mesh_add.remove(DEF_menu_func)
del bpy.types.Scene.atom_cluster
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
......
......@@ -306,7 +306,7 @@ class ViewButton():
#offs_2d = Vector((-self.wid / 2, 25))
offs_2d = Vector((-self.wid / 2, 0))
new2d = co2d + offs_2d
# co_bl == coordinate bottom left, co_tr == coordinate top right
co_bl = new2d[0], new2d[1]
co_tl = new2d[0], new2d[1] + self.hgt
......@@ -1078,7 +1078,7 @@ def draw_callback_px(self, context):
axis_pts = get_axis_line_co(pts2d[2], t2d, rwid, rhgt)
if axis_pts is not None:
draw_line_2d(axis_pts[0], axis_pts[1], Colr.white)
#btn_co = pts2d[2] + Vector((0, 20))
draw_line_2d(pts2d[0], pts2d[2], Colr.white)
draw_line_2d(pts2d[1], pts2d[2], Colr.white)
......
......@@ -401,7 +401,7 @@ class ViewButton():
#offs_2d = Vector((-self.wid / 2, 25))
offs_2d = Vector((-self.wid / 2, 0))
new2d = co2d + offs_2d
# co_bl == coordinate bottom left, co_tr == coordinate top right
co_bl = new2d[0], new2d[1]
co_tl = new2d[0], new2d[1] + self.hgt
......@@ -1272,7 +1272,7 @@ def do_rotate(self):
o_mat = create_z_orient(norml)
bpy.ops.transform.rotate(
value=RotDat.ang_diff_r,
value=RotDat.ang_diff_r,
orient_axis='Z',
orient_type='LOCAL',
#orient_type='GLOBAL',
......@@ -1303,7 +1303,7 @@ def do_rotate(self):
editmode_refresh()
# Uses axis_lock or piv_norm from RotDat to obtain rotation axis.
# Then rotates selected objects or selected vertices around the
# 3D cursor using RotDat's ang_diff_r radian value.
......@@ -1930,7 +1930,7 @@ class XEDIT_OT_set_meas(bpy.types.Operator):
if not popup_active:
process_popup_input(self)
set_help_text(self, "CLICK")
elif self.addon_mode == GET_0_OR_180:
choose_0_or_180(RotDat.lock_pts[2], RotDat.rot_pt_pos,
RotDat.rot_pt_neg, RotDat.ang_diff_r, self.mouse_co)
......
......@@ -67,7 +67,7 @@ def _Interna_Globals(BytesDadosTotProcess, context):
bl_context = "object"
bl_label = "Import Movement From Wav File"
bl_options = {'DEFAULT_CLOSED'}"""
class VIEW3D_PT_SoundPanel(bpy.types.Panel):
bl_idname = "IMPORTWAVTOOL_PT_tools"
bl_space_type = "VIEW_3D"
......@@ -76,7 +76,7 @@ class VIEW3D_PT_SoundPanel(bpy.types.Panel):
bl_label = "Import Tool"
bl_category = "Animate"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context):
layout = self.layout
......@@ -189,7 +189,7 @@ class VIEW3D_PT_SoundPanel(bpy.types.Panel):
row=layout.row()
row.label(text='Optional Configurations:')
row=layout.row()
row.prop(context.object.imp_sound_to_anim,"frames_per_second")
row=layout.row()
#coluna
......@@ -564,7 +564,7 @@ class OBJECT_OT_Botao_Import(bpy.types.Operator):
obi.iSumOptimizerP3=0
obi.iSumImportFrames=0
context.object.imp_sound_to_anim.timer_reset_func=False
#limita o loop se estiver no fim
tot=len(array)-1
if obi.RunFrom+loop > tot:
......@@ -981,7 +981,7 @@ class OBJECT_OT_Botao_Go(bpy.types.Operator):
RunFrom=0
Wave_read=0
MaxAudio=0
def SoundConv(File, DivSens, Sensibil, Resol, context, bAutoSense, bRemoveBeat, bUseBeat, bMoreSensible, \
bLessSensible, AudioChannel, loop):
obg= OBJECT_OT_Botao_Go
......@@ -1534,8 +1534,8 @@ def register():
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
#bpy.types.VIEW3D_MT_mesh_add.remove(WavFileImport)
bpy.utils.unregister_class(cls)
#bpy.types.VIEW3D_MT_mesh_add.remove(WavFileImport)
bpy.types.TOPBAR_MT_file_import.remove(WavFileImport)
......
......@@ -51,7 +51,7 @@ from bpy.props import (
from bpy.types import (
Panel,
PropertyGroup,
)
)
class OBJECT_PT_FRACTURE_Panel(Panel):
......@@ -70,10 +70,10 @@ class OBJECT_PT_FRACTURE_Panel(Panel):
layout.label(text="Use Fracture It First")
layout.operator("object.add_fracture_cell",
text="Fracture It")
layout.label(text="Use Crack It To Displace")
layout.label(text="Use Crack It To Displace")
layout.operator(operator.FRACTURE_OT_Crack.bl_idname,
text="Crack It")
material_props = context.window_manager.fracture_material_props
layout.separator()
box = layout.box()
......@@ -91,10 +91,10 @@ class OBJECT_PT_FRACTURE_Panel(Panel):
row = box.row()
row.operator(operator.FRACTURE_OT_Material.bl_idname, icon="MATERIAL_DATA",
text="Append Material")
text="Append Material")
class FractureCellProperties(PropertyGroup):
class FractureCellProperties(PropertyGroup):
# -------------------------------------------------------------------------
# Source Options
source_vert_own: IntProperty(
......@@ -133,16 +133,16 @@ class FractureCellProperties(PropertyGroup):
min=0, max=2000,
default=0,
)
'''
'''
source_limit: IntProperty(
name="Source Limit",
description="Limit the number of input points, 0 for unlimited",
min=0, max=5000,
default=100,
)
'''
'''
# -------------------------------------------------------------------------
# Transform
# Transform
source_noise: FloatProperty(
name="Noise",
description="Randomize point distribution",
......@@ -190,7 +190,7 @@ class FractureCellProperties(PropertyGroup):
recursion_source_limit: IntProperty(
name="Fracture Each",
description="Limit the number of input points, 0 for unlimited (applies to recursion only)",
min=2, max=2000, # Oviously, dividing in more than two objects is needed, to avoid no fracture object.
min=2, max=2000, # Oviously, dividing in more than two objects is needed, to avoid no fracture object.
default=8,
)
recursion_clamp: IntProperty(
......@@ -248,17 +248,17 @@ class FractureCellProperties(PropertyGroup):
default=False,
)
# -------------------------------------------------------------------------
# Scene Options
# Scene Options
use_collection: BoolProperty(
name="Use Collection",
description="Use collection to organize fracture objects",
default=True,
)
)
new_collection: BoolProperty(
name="New Collection",
description="Make new collection for fracture objects",
default=True,
)
)
collection_name: StringProperty(
name="Name",
description="Collection name.",
......@@ -275,12 +275,12 @@ class FractureCellProperties(PropertyGroup):
default=False,
)
# -------------------------------------------------------------------------
# Custom Property Options
# Custom Property Options
use_mass: BoolProperty(
name="Mass",
description="Append mass data on custom properties of cell objects.",
default=False,
)
)
mass_name: StringProperty(
name="Property Name",
description="Name for custome properties.",
......@@ -319,7 +319,7 @@ class FractureCellProperties(PropertyGroup):
default=False,
)
class FractureCrackProperties(PropertyGroup):
modifier_decimate : FloatProperty(
name="Reduce Faces",
......@@ -360,10 +360,10 @@ class FractureCrackProperties(PropertyGroup):
name="Wireframe Modifier",
description="Wireframe Modifier",
default=False
)
)
class FractureMaterialProperties(PropertyGroup):
class FractureMaterialProperties(PropertyGroup):
# Note: you can choose the original name in the library blend
# or the prop name
material_preset : EnumProperty(
......@@ -387,7 +387,7 @@ class FractureMaterialProperties(PropertyGroup):
"instead of the one defined in the Preset",
default=True
)
classes = (
FractureCellProperties,
FractureCrackProperties,
......@@ -411,13 +411,13 @@ def register():
)
bpy.types.WindowManager.fracture_material_props = PointerProperty(
type=FractureMaterialProperties
)
)
def unregister():
del bpy.types.WindowManager.fracture_material_props
del bpy.types.WindowManager.fracture_crack_props
del bpy.types.WindowManager.fracture_cell_props
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
\ No newline at end of file
unregister_class(cls)
......@@ -284,4 +284,4 @@ class FRACTURE_OT_Material(Operator):
)
return {"CANCELLED"}
return {'FINISHED'}
\ No newline at end of file
return {'FINISHED'}
......@@ -46,14 +46,14 @@ def points_to_verts(original_xyz_minmax,
xmin, xmax = original_xyz_minmax["x"]
ymin, ymax = original_xyz_minmax["y"]
zmin, zmax = original_xyz_minmax["z"]
xmin -= margin_bounds
xmax += margin_bounds
ymin -= margin_bounds
ymax += margin_bounds
zmin -= margin_bounds
zmax += margin_bounds
# (x,y,z,scaler) for plane. xyz is normaliized direction. scaler is scale for plane.
# Plane will be made at the perpendicular direction of the normal vector.
convexPlanes = [
......@@ -64,33 +64,33 @@ def points_to_verts(original_xyz_minmax,
Vector((0.0, 0.0, +1.0, -zmax)),
Vector((0.0, 0.0, -1.0, +zmin)),
]
if len(points) > 1:
points_dist_sorted = [(Vector(p[0]), p[1]) for p in points]
for i, point_current in enumerate(points):
planes = [None] * len(convexPlanes)
for j in range(len(convexPlanes)):
planes[j] = convexPlanes[j].copy()
planes[j] = convexPlanes[j].copy()
# e.g. Dot product point's (xyz) with convex's (+1.0,0.0,0.0) detects x value of the point.
# e.g. Then, x scaler += point's x value.
planes[j][3] += planes[j].xyz.dot(point_current[0])
distance_max = 10000000000.0 # a big value!
points_dist_sorted_current = points_dist_sorted.copy()
# Closer points to the current point are earlier order. Of course, current point is the first.
points_dist_sorted_current.sort(key=lambda p: (p[0] - point_current[0]).length_squared)
# The point itself is removed.
points_dist_sorted_current.pop(0)
points_dist_sorted_current.pop(0)
# Compare the current point with other points.
for j in range(len(points_dist_sorted_current)):
point_target = points_dist_sorted_current[j]
normal = 0
normal = point_target[0] - point_current[0]
normal = 0
normal = point_target[0] - point_current[0]
nlength = normal.length # is sqrt(X^2+y^2+z^2).
if points_scale is not None:
......@@ -115,7 +115,7 @@ def points_to_verts(original_xyz_minmax,
plane.resize_4d()
plane[3] = (-nlength / 2.0) + margin_cell
planes.append(plane)
# Make vertex points of cell, by crossing point of planes.
vertices[:], plane_indices[:] = mathutils.geometry.points_in_planes(planes)
#if len(vertices) == 0:
......@@ -125,7 +125,7 @@ def points_to_verts(original_xyz_minmax,
planes[:] = [planes[k] for k in plane_indices]
# for comparisons use length_squared and delay
# converting to a real length until the end.
# converting to a real length until the end.
distance_max = 10000000000.0 # a big value!
for v in vertices:
distance = v.length_squared
......@@ -136,14 +136,14 @@ def points_to_verts(original_xyz_minmax,
if len(vertices) == 0:
continue
cells.append((point_current[0], vertices[:]))
del vertices[:]
del vertices[:]
else:
vertices[:], plane_indices[:] = mathutils.geometry.points_in_planes(convexPlanes)
#convex_center = Vector(((xmin-xmax)/2, (ymin-ymax)/2, (zmin-zmax)/2))
convex_center = Vector((0,0,0))
cells.append((convex_center, vertices[:]))
return cells
\ No newline at end of file
return cells
......@@ -45,14 +45,14 @@ def points_from_object(original, original_xyz_minmax,
source_particle_child=0,
source_pencil=0,
source_random=0):
points = []
# This is not used by anywhere
def edge_center(mesh, edge):
v1, v2 = edge.vertices
return (mesh.vertices[v1].co + mesh.vertices[v2].co) / 2.0
# This is not used by anywhere
def poly_center(mesh, poly):
from mathutils import Vector
......@@ -62,13 +62,13 @@ def points_from_object(original, original_xyz_minmax,
co += mesh.vertices[mesh.loops[i].vertex_index].co
tot += 1
return co / tot
def points_from_verts(original):
"""Takes points from _any_ object with geometry"""
if original.type == 'MESH':
mesh = original.data
matrix = original.matrix_world.copy()
p = [(matrix @ v.co, 'VERTS') for v in mesh.vertices]
matrix = original.matrix_world.copy()
p = [(matrix @ v.co, 'VERTS') for v in mesh.vertices]
return p
else:
depsgraph = bpy.context.evaluated_depsgraph_get()
......@@ -78,21 +78,21 @@ def points_from_object(original, original_xyz_minmax,
except:
mesh = None
if mesh is not None:
if mesh is not None:
matrix = original.matrix_world.copy()
p = [(matrix @ v.co, 'VERTS') for v in mesh.vertices]
p = [(matrix @ v.co, 'VERTS') for v in mesh.vertices]
ob_eval.to_mesh_clear()
return p
def points_from_particles(original):
depsgraph = bpy.context.evaluated_depsgraph_get()
obj_eval = original.evaluated_get(depsgraph)
p = [(particle.location.copy(), 'PARTICLE')
for psys in obj_eval.particle_systems
for particle in psys.particles]
return p
def points_from_random(original, original_xyz_minmax):
xmin, xmax = original_xyz_minmax["x"]
ymin, ymax = original_xyz_minmax["y"]
......@@ -100,19 +100,19 @@ def points_from_object(original, original_xyz_minmax,
from random import uniform
from mathutils import Vector
p = []
for i in range(source_random):
new_pos = Vector( (uniform(xmin, xmax), uniform(ymin, ymax), uniform(zmin, zmax)) )
p.append((new_pos, 'RANDOM'))
return p
p.append((new_pos, 'RANDOM'))
return p
# geom own
if source_vert_own > 0:
new_points = points_from_verts(original)
new_points = _limit_source(new_points, source_vert_own)
points.extend(new_points)
# random
if source_random > 0:
new_points = points_from_random(original, original_xyz_minmax)
......@@ -125,7 +125,7 @@ def points_from_object(original, original_xyz_minmax,
new_points = points_from_verts(original_child)
new_points = _limit_source(new_points, source_vert_child)
points.extend(new_points)
# geom particles
if source_particle_own > 0:
new_points = points_from_particles(original)
......@@ -151,13 +151,13 @@ def points_from_object(original, original_xyz_minmax,
gpl.frames.new(current)
gpl.active_frame = current
fr = gpl.active_frame
return [get_points(stroke) for stroke in fr.strokes]
return [get_points(stroke) for stroke in fr.strokes]
else:
return []
if source_pencil > 0:
gp = bpy.context.scene.grease_pencil
if source_pencil > 0:
gp = bpy.context.scene.grease_pencil
if gp:
line_points = []
line_points = [(p, 'PENCIL') for spline in get_splines(gp)
......@@ -168,17 +168,17 @@ def points_from_object(original, original_xyz_minmax,
# Make New point between the line point and the closest point.
if not points:
points.extend(line_points)
else:
for lp in line_points:
# Make vector between the line point and its closest point.
points.sort(key=lambda p: (p[0] - lp[0]).length_squared)
closest_point = points[0]
closest_point = points[0]
normal = lp[0].xyz - closest_point[0].xyz
new_point = (lp[0], lp[1])
new_point[0].xyz += normal / 2
points.append(new_point)
#print("Found %d points" % len(points))
return points
......@@ -186,7 +186,7 @@ def points_from_object(original, original_xyz_minmax,
def points_to_cells(context, original, original_xyz_minmax, points,
source_limit=0,
source_noise=0.0,
source_noise=0.0,
use_smooth_faces=False,
use_data_match=False,
use_debug_points=False,
......@@ -199,16 +199,16 @@ def points_to_cells(context, original, original_xyz_minmax, points,
from . import cell_calc