Cleanup: trailing space
This commit is contained in:
parent
711829f2cd
commit
b858408364
|
@ -276,7 +276,7 @@ def register():
|
|||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
|
||||
add_curve_simple.register()
|
||||
add_curve_spirals.register()
|
||||
add_curve_aceous_galore.register()
|
||||
|
@ -287,7 +287,7 @@ def register():
|
|||
add_curve_spirofit_bouncespline.register()
|
||||
add_surface_plane_cone.register()
|
||||
beveltaper_curve.register()
|
||||
|
||||
|
||||
# Add "Extras" menu to the "Add Curve" menu
|
||||
bpy.types.VIEW3D_MT_curve_add.append(menu_func)
|
||||
# Add "Extras" menu to the "Add Surface" menu
|
||||
|
@ -299,7 +299,7 @@ def unregister():
|
|||
bpy.types.VIEW3D_MT_curve_add.remove(menu_func)
|
||||
# Remove "Extras" menu from the "Add Surface" menu.
|
||||
bpy.types.VIEW3D_MT_surface_add.remove(menu_surface)
|
||||
|
||||
|
||||
add_surface_plane_cone.unregister()
|
||||
add_curve_spirofit_bouncespline.unregister()
|
||||
add_curve_curly.unregister()
|
||||
|
@ -310,7 +310,7 @@ def unregister():
|
|||
add_curve_spirals.unregister()
|
||||
add_curve_simple.unregister()
|
||||
beveltaper_curve.unregister()
|
||||
|
||||
|
||||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
|
|
@ -232,7 +232,7 @@ class Braid(Operator):
|
|||
col.label(text="Geometry Options:")
|
||||
col.prop(self, "strandsize")
|
||||
col.prop(self, "resolution")
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
@ -240,7 +240,7 @@ class Braid(Operator):
|
|||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
circle = defaultCircle(self.strandsize)
|
||||
context.scene.collection.objects.link(circle)
|
||||
braid = awesome_braid(
|
||||
|
@ -258,10 +258,10 @@ class Braid(Operator):
|
|||
ob.select_set(False)
|
||||
braid.select_set(True)
|
||||
bpy.context.view_layer.objects.active = braid
|
||||
|
||||
|
||||
if use_enter_edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class CelticKnotOperator(Operator):
|
|||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
# Cache some values
|
||||
s = sin(self.crossing_angle) * self.crossing_strength
|
||||
c = cos(self.crossing_angle) * self.crossing_strength
|
||||
|
@ -271,9 +271,9 @@ class CelticKnotOperator(Operator):
|
|||
curve_obj.data.bevel_depth = self.geo_bDepth
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
bpy.context.view_layer.objects.active = orig_obj
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ def make_curve(self, context, verts, lh, rh):
|
|||
# create object
|
||||
if bpy.context.mode == 'EDIT_CURVE':
|
||||
Curve = context.active_object
|
||||
|
||||
|
||||
for spline in Curve.data.splines:
|
||||
if spline.type == 'BEZIER':
|
||||
for point in spline.bezier_points:
|
||||
|
@ -417,7 +417,7 @@ def make_curve(self, context, verts, lh, rh):
|
|||
# something weird with this one
|
||||
if types == 1 or types == 2 or types == 3:
|
||||
newSpline.bezier_points[3].handle_left.xyz = lh[p][3]
|
||||
|
||||
|
||||
else:
|
||||
# create curve
|
||||
dataCurve = bpy.data.curves.new(name='CurlyCurve', type='CURVE') # curvedatablock
|
||||
|
@ -438,8 +438,8 @@ def make_curve(self, context, verts, lh, rh):
|
|||
c += 1
|
||||
# something weird with this one
|
||||
if types == 1 or types == 2 or types == 3:
|
||||
newSpline.bezier_points[3].handle_left.xyz = lh[p][3]
|
||||
|
||||
newSpline.bezier_points[3].handle_left.xyz = lh[p][3]
|
||||
|
||||
# create object with newCurve
|
||||
Curve = object_data_add(context, dataCurve, operator=self) # place in active scene
|
||||
Curve.select_set(True)
|
||||
|
@ -451,7 +451,7 @@ def make_curve(self, context, verts, lh, rh):
|
|||
Curve.data.fill_mode = 'FULL'
|
||||
else:
|
||||
Curve.data.fill_mode = 'BOTH'
|
||||
|
||||
|
||||
# move and rotate spline in edit mode
|
||||
if bpy.context.mode == 'EDIT_CURVE':
|
||||
if self.align == "WORLD":
|
||||
|
@ -460,7 +460,7 @@ def make_curve(self, context, verts, lh, rh):
|
|||
bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = self.rotation[1], orient_axis = 'Y', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = self.rotation[2], orient_axis = 'Z', orient_type='GLOBAL')
|
||||
|
||||
|
||||
elif self.align == "VIEW":
|
||||
bpy.ops.transform.translate(value = self.location)
|
||||
bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X')
|
||||
|
@ -508,7 +508,7 @@ class add_curlycurve(Operator, AddObjectHelper):
|
|||
('3D', "3D", "3D")
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
edit_mode : BoolProperty(
|
||||
name="Show in edit mode",
|
||||
default=True,
|
||||
|
@ -526,13 +526,13 @@ class add_curlycurve(Operator, AddObjectHelper):
|
|||
col.label(text = "Resize:")
|
||||
col.prop(self, "scale_x")
|
||||
col.prop(self, "scale_y")
|
||||
|
||||
|
||||
row = layout.row()
|
||||
row.prop(self, "shape", expand=True)
|
||||
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
||||
col = layout.column(align=True)
|
||||
# AddObjectHelper props
|
||||
col.prop(self, "align")
|
||||
|
@ -543,7 +543,7 @@ class add_curlycurve(Operator, AddObjectHelper):
|
|||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
if self.types == 1:
|
||||
add_type1(self, context)
|
||||
if self.types == 2:
|
||||
|
@ -564,10 +564,10 @@ class add_curlycurve(Operator, AddObjectHelper):
|
|||
add_type9(self, context)
|
||||
if self.types == 10:
|
||||
add_type10(self, context)
|
||||
|
||||
|
||||
if use_enter_edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
|
|
@ -408,7 +408,7 @@ def vertsToPoints(Verts, splineType):
|
|||
def main(context, self, use_enter_edit_mode):
|
||||
# output splineType 'POLY' 'NURBS' 'BEZIER'
|
||||
splineType = self.outputType
|
||||
|
||||
|
||||
sides = abs(int((self.Simple_endangle - self.Simple_startangle) / 90))
|
||||
|
||||
# get verts
|
||||
|
@ -499,25 +499,25 @@ def main(context, self, use_enter_edit_mode):
|
|||
verts = SimpleTrapezoid(
|
||||
self.Simple_a, self.Simple_b, self.Simple_h, self.Simple_center
|
||||
)
|
||||
|
||||
|
||||
# turn verts into array
|
||||
vertArray = vertsToPoints(verts, splineType)
|
||||
|
||||
|
||||
# create object
|
||||
if bpy.context.mode == 'EDIT_CURVE':
|
||||
|
||||
|
||||
Curve = context.active_object
|
||||
newSpline = Curve.data.splines.new(type=splineType) # spline
|
||||
else:
|
||||
name = self.Simple_Type # Type as name
|
||||
|
||||
|
||||
dataCurve = bpy.data.curves.new(name, type='CURVE') # curve data block
|
||||
newSpline = dataCurve.splines.new(type=splineType) # spline
|
||||
|
||||
# create object with new Curve
|
||||
Curve = object_utils.object_data_add(context, dataCurve, operator=self) # place in active scene
|
||||
Curve.select_set(True)
|
||||
|
||||
|
||||
for spline in Curve.data.splines:
|
||||
if spline.type == 'BEZIER':
|
||||
for point in spline.bezier_points:
|
||||
|
@ -527,7 +527,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
else:
|
||||
for point in spline.points:
|
||||
point.select = False
|
||||
|
||||
|
||||
# create spline from vertarray
|
||||
all_points = []
|
||||
if splineType == 'BEZIER':
|
||||
|
@ -547,7 +547,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
for point in newSpline.points:
|
||||
all_points.append(point)
|
||||
point.select = True
|
||||
|
||||
|
||||
n = len(all_points)
|
||||
|
||||
d = 2 * 0.27606262
|
||||
|
@ -613,7 +613,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
p1.handle_right = v1
|
||||
p2.handle_left = v2
|
||||
i += 1
|
||||
|
||||
|
||||
if self.Simple_Type == 'Ellipse':
|
||||
all_points[0].handle_right = Vector((self.Simple_a, self.Simple_b * d, 0))
|
||||
all_points[0].handle_left = Vector((self.Simple_a, -self.Simple_b * d, 0))
|
||||
|
@ -623,7 +623,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
all_points[2].handle_left = Vector((-self.Simple_a, self.Simple_b * d, 0))
|
||||
all_points[3].handle_right = Vector((self.Simple_a * d, -self.Simple_b, 0))
|
||||
all_points[3].handle_left = Vector((-self.Simple_a * d, -self.Simple_b, 0))
|
||||
|
||||
|
||||
if self.Simple_Type == 'Arc':
|
||||
i = 0
|
||||
for p1 in all_points:
|
||||
|
@ -660,7 +660,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
i += 1
|
||||
all_points[0].handle_left_type = 'VECTOR'
|
||||
all_points[-1].handle_right_type = 'VECTOR'
|
||||
|
||||
|
||||
if self.Simple_Type == 'Sector':
|
||||
i = 0
|
||||
for p1 in all_points:
|
||||
|
@ -702,7 +702,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
all_points[0].handle_right_type = 'VECTOR'
|
||||
all_points[1].handle_left_type = 'VECTOR'
|
||||
all_points[-1].handle_right_type = 'VECTOR'
|
||||
|
||||
|
||||
if self.Simple_Type == 'Segment':
|
||||
i = 0
|
||||
if self.Simple_a > self.Simple_b:
|
||||
|
@ -772,7 +772,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
v2 = Vector((p2.co.x, p2.co.y, 0)) - vh2
|
||||
p1.handle_right = v1
|
||||
p2.handle_left = v2
|
||||
|
||||
|
||||
i += 1
|
||||
all_points[0].handle_left_type = 'VECTOR'
|
||||
all_points[n - 1].handle_right_type = 'VECTOR'
|
||||
|
@ -783,7 +783,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
newSpline.use_cyclic_u = self.use_cyclic_u
|
||||
newSpline.use_endpoint_u = self.endp_u
|
||||
newSpline.order_u = self.order_u
|
||||
|
||||
|
||||
# set curve Options
|
||||
Curve.data.dimensions = self.shape
|
||||
Curve.data.use_path = True
|
||||
|
@ -791,7 +791,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
Curve.data.fill_mode = 'FULL'
|
||||
else:
|
||||
Curve.data.fill_mode = 'BOTH'
|
||||
|
||||
|
||||
# move and rotate spline in edit mode
|
||||
if bpy.context.mode == 'EDIT_CURVE':
|
||||
if self.align == "WORLD":
|
||||
|
@ -800,7 +800,7 @@ def main(context, self, use_enter_edit_mode):
|
|||
bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = self.rotation[1], orient_axis = 'Y', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = self.rotation[2], orient_axis = 'Z', orient_type='GLOBAL')
|
||||
|
||||
|
||||
elif self.align == "VIEW":
|
||||
bpy.ops.transform.translate(value = self.location)
|
||||
bpy.ops.transform.rotate(value = self.rotation[0], orient_axis = 'X')
|
||||
|
@ -875,7 +875,7 @@ def menu(self, context):
|
|||
oper14 = self.layout.operator(Simple.bl_idname, text="Trapezoid", icon="MOD_EDGESPLIT")
|
||||
oper14.Simple_Type = "Trapezoid"
|
||||
oper14.use_cyclic_u = True
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Simple operator
|
||||
|
||||
|
@ -1236,12 +1236,12 @@ class Simple(Operator, object_utils.AddObjectHelper):
|
|||
|
||||
row = layout.row()
|
||||
row.prop(self, "shape", expand=True)
|
||||
|
||||
|
||||
# output options
|
||||
col = layout.column()
|
||||
col.label(text="Output Curve Type:")
|
||||
col.row().prop(self, "outputType", expand=True)
|
||||
|
||||
|
||||
if self.outputType == 'NURBS':
|
||||
col.prop(self, "order_u")
|
||||
elif self.outputType == 'BEZIER':
|
||||
|
@ -1249,10 +1249,10 @@ class Simple(Operator, object_utils.AddObjectHelper):
|
|||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "use_cyclic_u", expand=True)
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
||||
col = layout.column()
|
||||
# AddObjectHelper props
|
||||
col.prop(self, "align")
|
||||
|
@ -1274,29 +1274,29 @@ class Simple(Operator, object_utils.AddObjectHelper):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
# main function
|
||||
main(context, self, use_enter_edit_mode)
|
||||
|
||||
|
||||
if use_enter_edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
||||
if self.edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
else:
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
def invoke(self, context, event):
|
||||
|
||||
|
||||
self.execute(context)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
|
|
@ -220,7 +220,7 @@ def vertsToPoints(Verts, splineType):
|
|||
def draw_curve(props, context, align_matrix):
|
||||
# output splineType 'POLY' 'NURBS' 'BEZIER'
|
||||
splineType = props.curve_type
|
||||
|
||||
|
||||
if props.spiral_type == 'ARCH':
|
||||
verts = make_spiral(props, context)
|
||||
if props.spiral_type == 'LOG':
|
||||
|
@ -238,13 +238,13 @@ def draw_curve(props, context, align_matrix):
|
|||
# create curve
|
||||
dataCurve = bpy.data.curves.new(name='Spiral', type='CURVE') # curvedatablock
|
||||
newSpline = dataCurve.splines.new(type=splineType) # spline
|
||||
|
||||
|
||||
# create object with newCurve
|
||||
Curve = object_data_add(context, dataCurve) # place in active scene
|
||||
Curve.matrix_world = align_matrix # apply matrix
|
||||
Curve.rotation_euler = props.rotation_euler
|
||||
Curve.select_set(True)
|
||||
|
||||
|
||||
# set curveOptions
|
||||
Curve.data.dimensions = props.shape
|
||||
Curve.data.use_path = True
|
||||
|
@ -252,15 +252,15 @@ def draw_curve(props, context, align_matrix):
|
|||
Curve.data.fill_mode = 'FULL'
|
||||
else:
|
||||
Curve.data.fill_mode = 'BOTH'
|
||||
|
||||
|
||||
# set curveOptions
|
||||
newSpline.use_cyclic_u = props.use_cyclic_u
|
||||
newSpline.use_endpoint_u = props.endp_u
|
||||
newSpline.order_u = props.order_u
|
||||
|
||||
|
||||
# turn verts into array
|
||||
vertArray = vertsToPoints(verts, splineType)
|
||||
|
||||
|
||||
for spline in Curve.data.splines:
|
||||
if spline.type == 'BEZIER':
|
||||
for point in spline.bezier_points:
|
||||
|
@ -270,7 +270,7 @@ def draw_curve(props, context, align_matrix):
|
|||
else:
|
||||
for point in spline.points:
|
||||
point.select = False
|
||||
|
||||
|
||||
# create newSpline from vertarray
|
||||
if splineType == 'BEZIER':
|
||||
newSpline.bezier_points.add(int(len(vertArray) * 0.33))
|
||||
|
@ -303,7 +303,7 @@ class CURVE_OT_spirals(Operator):
|
|||
|
||||
# align_matrix for the invoke
|
||||
align_matrix : Matrix()
|
||||
|
||||
|
||||
spiral_type : EnumProperty(
|
||||
items=[('ARCH', "Archemedian", "Archemedian"),
|
||||
("LOG", "Logarithmic", "Logarithmic"),
|
||||
|
@ -513,12 +513,12 @@ class CURVE_OT_spirals(Operator):
|
|||
|
||||
row = layout.row()
|
||||
row.prop(self, "shape", expand=True)
|
||||
|
||||
|
||||
# output options
|
||||
col = layout.column()
|
||||
col.label(text="Output Curve Type:")
|
||||
col.row().prop(self, "curve_type", expand=True)
|
||||
|
||||
|
||||
if self.curve_type == 'NURBS':
|
||||
col.prop(self, "order_u")
|
||||
elif self.curve_type == 'BEZIER':
|
||||
|
@ -529,7 +529,7 @@ class CURVE_OT_spirals(Operator):
|
|||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
||||
box = layout.box()
|
||||
box.label(text="Location:")
|
||||
box.prop(self, "startlocation")
|
||||
|
@ -545,17 +545,17 @@ class CURVE_OT_spirals(Operator):
|
|||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
time_start = time.time()
|
||||
self.align_matrix = align_matrix(context, self.startlocation)
|
||||
draw_curve(self, context, self.align_matrix)
|
||||
|
||||
|
||||
if use_enter_edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
||||
if self.edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
else:
|
||||
|
|
|
@ -669,7 +669,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
|
|||
box.prop(self, "colorSet")
|
||||
box.prop(self, "random_colors")
|
||||
box.prop(self, "saturation")
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
@ -689,7 +689,7 @@ class torus_knot_plus(Operator, AddObjectHelper):
|
|||
# turn off 'Enter Edit Mode'
|
||||
use_enter_edit_mode = bpy.context.preferences.edit.use_enter_edit_mode
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = False
|
||||
|
||||
|
||||
if self.mode == 'EXT_INT':
|
||||
# adjust the equivalent radii pair : (R,r) <=> (eR,iR)
|
||||
self.torus_R = (self.torus_eR + self.torus_iR) * 0.5
|
||||
|
@ -721,10 +721,10 @@ class torus_knot_plus(Operator, AddObjectHelper):
|
|||
|
||||
# create the curve
|
||||
create_torus_knot(self, context)
|
||||
|
||||
|
||||
if use_enter_edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# restore pre operator state
|
||||
bpy.context.preferences.edit.use_enter_edit_mode = use_enter_edit_mode
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ class add_tapercurve(Operator):
|
|||
col_sub.active = self.link2
|
||||
row.prop(self, "link2", toggle=True, text="", icon="LINKED")
|
||||
col_sub.prop(self, "diff")
|
||||
|
||||
|
||||
col = layout.column()
|
||||
col.row().prop(self, "edit_mode", expand=True)
|
||||
|
||||
|
@ -325,7 +325,7 @@ class add_tapercurve(Operator):
|
|||
self.scale_ends2 = self.scale_ends1 = self.scale_mid - self.diff
|
||||
|
||||
add_taper(self, context)
|
||||
|
||||
|
||||
if self.edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
else:
|
||||
|
@ -410,7 +410,7 @@ class add_bevelcurve(Operator, AddObjectHelper):
|
|||
add_type4(self, context)
|
||||
if self.types == 5:
|
||||
add_type5(self, context)
|
||||
|
||||
|
||||
if self.edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
else:
|
||||
|
|
|
@ -340,7 +340,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if context.selected_objects != [] and context.active_object and \
|
||||
('Bolt' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -353,16 +353,16 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||
bpy.ops.object.vertex_group_remove(all=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
for material in oldmesh.materials:
|
||||
obj.data.materials.append(material)
|
||||
|
||||
|
||||
bpy.data.meshes.remove(oldmesh)
|
||||
obj.data.name = oldmeshname
|
||||
else:
|
||||
mesh = createMesh.Create_New_Mesh(self, context)
|
||||
obj = object_utils.object_data_add(context, mesh, operator=None)
|
||||
|
||||
|
||||
obj.data["Bolt"] = True
|
||||
obj.data["change"] = False
|
||||
for prm in BoltParameters():
|
||||
|
@ -374,7 +374,7 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
mesh = createMesh.Create_New_Mesh(self, context)
|
||||
obj = object_utils.object_data_add(context, mesh, operator=None)
|
||||
|
||||
|
||||
obj.select_set(True)
|
||||
active_object.select_set(True)
|
||||
bpy.ops.object.join()
|
||||
|
@ -391,10 +391,10 @@ class add_mesh_bolt(Operator, AddObjectHelper):
|
|||
# Register:
|
||||
def Bolt_contex_menu(self, context):
|
||||
bl_label = 'Change'
|
||||
|
||||
|
||||
obj = context.object
|
||||
layout = self.layout
|
||||
|
||||
|
||||
if 'Bolt' in obj.data.keys():
|
||||
props = layout.operator("mesh.bolt_add", text="Change Bolt")
|
||||
props.change = True
|
||||
|
@ -412,8 +412,8 @@ classes = (
|
|||
add_mesh_bolt,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
|
|
@ -46,7 +46,7 @@ import bpy
|
|||
|
||||
def register():
|
||||
Boltfactory.register()
|
||||
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
|
|
|
@ -90,11 +90,11 @@ def register():
|
|||
def unregister():
|
||||
# Remove "Extras" menu from the "Add Mesh" menu.
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(menu_func)
|
||||
|
||||
|
||||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
|
||||
del bpy.types.Scene.discombobulator
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -567,7 +567,7 @@ class chooseDoodad(Operator):
|
|||
msg = "Object with this name already saved"
|
||||
|
||||
DISC_doodads = context.scene.discombobulator.DISC_doodads
|
||||
|
||||
|
||||
if obj_name not in DISC_doodads:
|
||||
DISC_doodads.append(obj_name)
|
||||
msg = "Saved Doodad object: {}".format(obj_name)
|
||||
|
@ -641,7 +641,7 @@ class discombobulator_dodads_list(Menu):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
DISC_doodads = context.scene.discombobulator.DISC_doodads
|
||||
|
||||
doodle = len(DISC_doodads)
|
||||
|
@ -788,7 +788,7 @@ class VIEW3D_OT_tools_discombobulate(Operator):
|
|||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
self.DISC_doodads = bpy.context.scene.discombobulator.DISC_doodads
|
||||
|
||||
row = layout.row()
|
||||
|
|
|
@ -65,7 +65,7 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
|
|||
|
||||
# UI items - API for properties - User accessible variables...
|
||||
# not all options are via UI, and some operations just don't work yet
|
||||
|
||||
|
||||
Wall : BoolProperty(name = "Wall",
|
||||
default = True,
|
||||
description = "Wall")
|
||||
|
@ -899,14 +899,14 @@ class add_mesh_wallb(Operator, object_utils.AddObjectHelper):
|
|||
obj = object_utils.object_data_add(context, mesh, operator=None)
|
||||
|
||||
utils.setlocation(self, context)
|
||||
|
||||
|
||||
mesh.update()
|
||||
|
||||
|
||||
obj.data["Wall"] = True
|
||||
obj.data["change"] = False
|
||||
for prm in WallParameters():
|
||||
obj.data[prm] = getattr(self, prm)
|
||||
|
||||
|
||||
if bpy.context.mode == "EDIT_MESH":
|
||||
active_object = context.active_object
|
||||
name_active_object = active_object.name
|
||||
|
|
|
@ -234,10 +234,10 @@ def menu_func(self, context):
|
|||
|
||||
def Extras_contex_menu(self, context):
|
||||
bl_label = 'Change'
|
||||
|
||||
|
||||
obj = context.object
|
||||
layout = self.layout
|
||||
|
||||
|
||||
if 'Gear' in obj.data.keys():
|
||||
props = layout.operator("mesh.primitive_gear", text="Change Gear")
|
||||
props.change = True
|
||||
|
@ -251,7 +251,7 @@ def Extras_contex_menu(self, context):
|
|||
for prm in add_mesh_gears.WormGearParameters():
|
||||
setattr(props, prm, obj.data[prm])
|
||||
layout.separator()
|
||||
|
||||
|
||||
if 'Beam' in obj.data.keys():
|
||||
props = layout.operator("mesh.add_beam", text="Change Beam")
|
||||
props.change = True
|
||||
|
@ -307,14 +307,14 @@ def Extras_contex_menu(self, context):
|
|||
for prm in add_mesh_gemstones.DiamondParameters():
|
||||
setattr(props, prm, obj.data[prm])
|
||||
layout.separator()
|
||||
|
||||
|
||||
if 'Gem' in obj.data.keys():
|
||||
props = layout.operator("mesh.primitive_gem_add", text="Change Gem")
|
||||
props.change = True
|
||||
for prm in add_mesh_gemstones.GemParameters():
|
||||
setattr(props, prm, obj.data[prm])
|
||||
layout.separator()
|
||||
|
||||
|
||||
if 'Brilliant' in obj.data.keys():
|
||||
props = layout.operator("mesh.primitive_brilliant_add", text="Change Brilliant")
|
||||
props.change = True
|
||||
|
@ -380,7 +380,7 @@ def unregister():
|
|||
# Remove "Extras" menu from the "Add Mesh" menu and context menu.
|
||||
bpy.types.VIEW3D_MT_object_context_menu.remove(Extras_contex_menu)
|
||||
bpy.types.VIEW3D_MT_mesh_add.remove(menu_func)
|
||||
|
||||
|
||||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
|
|
@ -536,13 +536,13 @@ class AddXYZFunctionSurface(Operator):
|
|||
return {'CANCELLED'}
|
||||
|
||||
obj = create_mesh_object(context, verts, [], faces, "XYZ Function")
|
||||
|
||||
|
||||
if self.show_wire:
|
||||
obj.show_wire = True
|
||||
|
||||
|
||||
if self.edit_mode:
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
else:
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
|
||||
return {'FINISHED'}
|
||||
|
|
|
@ -693,7 +693,7 @@ class addBeam(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change Beam")
|
||||
|
||||
|
||||
Type: EnumProperty(
|
||||
items=(
|
||||
('0', "Box Profile", "Square Beam"),
|
||||
|
@ -803,7 +803,7 @@ class addBeam(Operator, object_utils.AddObjectHelper):
|
|||
obj.data[prm] = getattr(self, prm)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
if bpy.context.mode == "EDIT_MESH":
|
||||
active_object = context.active_object
|
||||
name_active_object = active_object.name
|
||||
|
|
|
@ -543,7 +543,7 @@ def add_worm(teethNum, rowNum, radius, Ad, De, p_angle,
|
|||
return verts, faces, vgroup_top, vgroup_valley
|
||||
|
||||
def AddGearMesh(self, context):
|
||||
|
||||
|
||||
verts, faces, verts_tip, verts_valley = add_gear(
|
||||
self.number_of_teeth,
|
||||
self.radius,
|
||||
|
@ -556,10 +556,10 @@ def AddGearMesh(self, context):
|
|||
conangle=self.conangle,
|
||||
crown=self.crown
|
||||
)
|
||||
|
||||
|
||||
mesh = bpy.data.meshes.new("Gear")
|
||||
mesh.from_pydata(verts, [], faces)
|
||||
|
||||
|
||||
return mesh, verts_tip, verts_valley
|
||||
|
||||
|
||||
|
@ -684,7 +684,7 @@ class AddGear(Operator, object_utils.AddObjectHelper):
|
|||
return context.scene is not None
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if context.selected_objects != [] and context.active_object and \
|
||||
('Gear' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -697,10 +697,10 @@ class AddGear(Operator, object_utils.AddObjectHelper):
|
|||
bpy.ops.object.vertex_group_remove(all=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
for material in oldmesh.materials:
|
||||
obj.data.materials.append(material)
|
||||
|
||||
|
||||
bpy.data.meshes.remove(oldmesh)
|
||||
obj.data.name = oldmeshname
|
||||
else:
|
||||
|
@ -712,10 +712,10 @@ class AddGear(Operator, object_utils.AddObjectHelper):
|
|||
# Create vertex groups from stored vertices.
|
||||
tipGroup = obj.vertex_groups.new(name='Tips')
|
||||
tipGroup.add(verts_tip, 1.0, 'ADD')
|
||||
|
||||
|
||||
valleyGroup = obj.vertex_groups.new(name='Valleys')
|
||||
valleyGroup.add(verts_valley, 1.0, 'ADD')
|
||||
|
||||
|
||||
obj.data["Gear"] = True
|
||||
obj.data["change"] = False
|
||||
for prm in GearParameters():
|
||||
|
@ -727,14 +727,14 @@ class AddGear(Operator, object_utils.AddObjectHelper):
|
|||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
mesh, verts_tip, verts_valley = AddGearMesh(self, context)
|
||||
obj = object_utils.object_data_add(context, mesh, operator=None)
|
||||
|
||||
|
||||
# Create vertex groups from stored vertices.
|
||||
tipGroup = obj.vertex_groups.new(name='Tips')
|
||||
tipGroup.add(verts_tip, 1.0, 'ADD')
|
||||
|
||||
|
||||
valleyGroup = obj.vertex_groups.new(name='Valleys')
|
||||
valleyGroup.add(verts_valley, 1.0, 'ADD')
|
||||
|
||||
|
||||
obj.select_set(True)
|
||||
active_object.select_set(True)
|
||||
bpy.ops.object.join()
|
||||
|
@ -778,10 +778,10 @@ def AddWormGearMesh(self, context):
|
|||
skew=self.skew,
|
||||
crown=self.crown
|
||||
)
|
||||
|
||||
|
||||
mesh = bpy.data.meshes.new("Worm Gear")
|
||||
mesh.from_pydata(verts, [], faces)
|
||||
|
||||
|
||||
return mesh, verts_tip, verts_valley
|
||||
|
||||
|
||||
|
@ -913,10 +913,10 @@ class AddWormGear(Operator, object_utils.AddObjectHelper):
|
|||
bpy.ops.object.vertex_group_remove(all=True)
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
for material in oldmesh.materials:
|
||||
obj.data.materials.append(material)
|
||||
|
||||
|
||||
bpy.data.meshes.remove(oldmesh)
|
||||
obj.data.name = oldmeshname
|
||||
else:
|
||||
|
@ -928,10 +928,10 @@ class AddWormGear(Operator, object_utils.AddObjectHelper):
|
|||
# Create vertex groups from stored vertices.
|
||||
tipGroup = obj.vertex_groups.new(name = 'Tips')
|
||||
tipGroup.add(verts_tip, 1.0, 'ADD')
|
||||
|
||||
|
||||
valleyGroup = obj.vertex_groups.new(name = 'Valleys')
|
||||
valleyGroup.add(verts_valley, 1.0, 'ADD')
|
||||
|
||||
|
||||
obj.data["WormGear"] = True
|
||||
obj.data["change"] = False
|
||||
for prm in WormGearParameters():
|
||||
|
@ -943,14 +943,14 @@ class AddWormGear(Operator, object_utils.AddObjectHelper):
|
|||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
mesh, verts_tip, verts_valley = AddWormGearMesh(self, context)
|
||||
obj = object_utils.object_data_add(context, mesh, operator=None)
|
||||
|
||||
|
||||
# Create vertex groups from stored vertices.
|
||||
tipGroup = obj.vertex_groups.new(name = 'Tips')
|
||||
tipGroup.add(verts_tip, 1.0, 'ADD')
|
||||
|
||||
|
||||
valleyGroup = obj.vertex_groups.new(name = 'Valleys')
|
||||
valleyGroup.add(verts_valley, 1.0, 'ADD')
|
||||
|
||||
|
||||
obj.select_set(True)
|
||||
active_object.select_set(True)
|
||||
bpy.ops.object.join()
|
||||
|
|
|
@ -279,7 +279,7 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
|
|||
box.prop(self, 'rotation')
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if context.selected_objects != [] and context.active_object and \
|
||||
('Diamond' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -296,7 +296,7 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
|
|||
mesh.from_pydata(verts, [], faces)
|
||||
mesh.update()
|
||||
obj.data = mesh
|
||||
|
||||
|
||||
for material in oldmesh.materials:
|
||||
obj.data.materials.append(material)
|
||||
|
||||
|
@ -317,7 +317,7 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
|
|||
obj.data["change"] = False
|
||||
for prm in DiamondParameters():
|
||||
obj.data[prm] = getattr(self, prm)
|
||||
|
||||
|
||||
if bpy.context.mode == "EDIT_MESH":
|
||||
active_object = context.active_object
|
||||
name_active_object = active_object.name
|
||||
|
@ -329,7 +329,7 @@ class AddDiamond(Operator, object_utils.AddObjectHelper):
|
|||
self.pavilion_height)
|
||||
|
||||
obj = create_mesh_object(context, verts, [], faces, "TMP")
|
||||
|
||||
|
||||
obj.select_set(True)
|
||||
active_object.select_set(True)
|
||||
bpy.ops.object.join()
|
||||
|
@ -368,7 +368,7 @@ class AddGem(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change Gem")
|
||||
|
||||
|
||||
segments: IntProperty(
|
||||
name="Segments",
|
||||
description="Longitudial segmentation",
|
||||
|
@ -420,9 +420,9 @@ class AddGem(Operator, object_utils.AddObjectHelper):
|
|||
box.prop(self, 'align')
|
||||
box.prop(self, 'location')
|
||||
box.prop(self, 'rotation')
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if context.selected_objects != [] and context.active_object and \
|
||||
('Gem' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -459,7 +459,7 @@ class AddGem(Operator, object_utils.AddObjectHelper):
|
|||
obj.data["change"] = False
|
||||
for prm in GemParameters():
|
||||
obj.data[prm] = getattr(self, prm)
|
||||
|
||||
|
||||
if bpy.context.mode == "EDIT_MESH":
|
||||
active_object = context.active_object
|
||||
name_active_object = active_object.name
|
||||
|
@ -472,7 +472,7 @@ class AddGem(Operator, object_utils.AddObjectHelper):
|
|||
self.crown_height)
|
||||
|
||||
obj = create_mesh_object(context, verts, [], faces, "TMP")
|
||||
|
||||
|
||||
obj.select_set(True)
|
||||
active_object.select_set(True)
|
||||
bpy.ops.object.join()
|
||||
|
|
|
@ -112,7 +112,7 @@ class AddElbowJoint(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change ElbowJoint")
|
||||
|
||||
|
||||
radius: FloatProperty(
|
||||
name="Radius",
|
||||
description="The radius of the pipe",
|
||||
|
@ -224,7 +224,7 @@ class AddElbowJoint(Operator, object_utils.AddObjectHelper):
|
|||
# Create faces
|
||||
faces.extend(createFaces(loop1, loop2, closed=True))
|
||||
faces.extend(createFaces(loop2, loop3, closed=True))
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if (context.selected_objects != []) and context.active_object and \
|
||||
('ElbowJoint' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -294,7 +294,7 @@ class AddTeeJoint(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change TeeJoint")
|
||||
|
||||
|
||||
radius: FloatProperty(
|
||||
name="Radius",
|
||||
description="The radius of the pipe",
|
||||
|
@ -483,7 +483,7 @@ class AddTeeJoint(Operator, object_utils.AddObjectHelper):
|
|||
faces.extend(createFaces(loopMainStart, loopJoint1, closed=True))
|
||||
faces.extend(createFaces(loopJoint2, loopArm, closed=True))
|
||||
faces.extend(createFaces(loopJoint3, loopMainEnd, closed=True))
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if (context.selected_objects != []) and context.active_object and \
|
||||
('TeeJoint' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -551,7 +551,7 @@ class AddWyeJoint(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change WyeJoint")
|
||||
|
||||
|
||||
radius: FloatProperty(
|
||||
name="Radius",
|
||||
description="The radius of the pipe",
|
||||
|
@ -759,7 +759,7 @@ class AddWyeJoint(Operator, object_utils.AddObjectHelper):
|
|||
faces.extend(createFaces(loopMainStart, loopJoint1, closed=True))
|
||||
faces.extend(createFaces(loopJoint2, loopArm1, closed=True))
|
||||
faces.extend(createFaces(loopJoint3, loopArm2, closed=True))
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if (context.selected_objects != []) and context.active_object and \
|
||||
('WyeJoint' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -831,7 +831,7 @@ class AddCrossJoint(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change CrossJoint")
|
||||
|
||||
|
||||
radius: FloatProperty(
|
||||
name="Radius",
|
||||
description="The radius of the pipe",
|
||||
|
@ -1099,7 +1099,7 @@ class AddCrossJoint(Operator, object_utils.AddObjectHelper):
|
|||
faces.extend(createFaces(loopJoint2, loopArm1, closed=True))
|
||||
faces.extend(createFaces(loopJoint3, loopArm2, closed=True))
|
||||
faces.extend(createFaces(loopJoint4, loopArm3, closed=True))
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if (context.selected_objects != []) and context.active_object and \
|
||||
('CrossJoint' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -1166,7 +1166,7 @@ class AddNJoint(Operator, object_utils.AddObjectHelper):
|
|||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change NJoint")
|
||||
|
||||
|
||||
radius: FloatProperty(
|
||||
name="Radius",
|
||||
description="The radius of the pipe",
|
||||
|
@ -1336,7 +1336,7 @@ class AddNJoint(Operator, object_utils.AddObjectHelper):
|
|||
faces.extend(
|
||||
createFaces(loopsJoints[loopIdx],
|
||||
loopsEndCircles[loopIdx], closed=True))
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if (context.selected_objects != []) and context.active_object and \
|
||||
('NJoint' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
|
|
@ -225,7 +225,7 @@ def add_mesh_Brilliant(context, s, table_w, crown_h, girdle_t, pavi_d, bezel_f,
|
|||
dmesh = bpy.data.meshes.new("dmesh")
|
||||
dmesh.from_pydata(Verts, [], Faces)
|
||||
dmesh.update()
|
||||
|
||||
|
||||
return dmesh
|
||||
|
||||
# object generating function, returns final object
|
||||
|
@ -321,7 +321,7 @@ class MESH_OT_primitive_brilliant_add(Operator, object_utils.AddObjectHelper):
|
|||
|
||||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change Brilliant")
|
||||
description = "change Brilliant")
|
||||
|
||||
s: IntProperty(
|
||||
name="Segments",
|
||||
|
@ -428,7 +428,7 @@ class MESH_OT_primitive_brilliant_add(Operator, object_utils.AddObjectHelper):
|
|||
|
||||
# call mesh/object generator function with user inputs
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if bpy.context.mode == "OBJECT":
|
||||
if context.selected_objects != [] and context.active_object and \
|
||||
('Brilliant' in context.active_object.data.keys()) and (self.change == True):
|
||||
|
@ -457,7 +457,7 @@ class MESH_OT_primitive_brilliant_add(Operator, object_utils.AddObjectHelper):
|
|||
obj.data["change"] = False
|
||||
for prm in BrilliantParameters():
|
||||
obj.data[prm] = getattr(self, prm)
|
||||
|
||||
|
||||
if bpy.context.mode == "EDIT_MESH":
|
||||
active_object = context.active_object
|
||||
name_active_object = active_object.name
|
||||
|
|
|
@ -27,7 +27,7 @@ def setlocation(oper, context):
|
|||
bpy.ops.transform.rotate(value = oper.rotation[0], orient_axis = 'X', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = oper.rotation[1], orient_axis = 'Y', orient_type='GLOBAL')
|
||||
bpy.ops.transform.rotate(value = oper.rotation[2], orient_axis = 'Z', orient_type='GLOBAL')
|
||||
|
||||
|
||||
elif oper.align == "VIEW":
|
||||
bpy.ops.transform.translate(value = oper.location)
|
||||
bpy.ops.transform.rotate(value = oper.rotation[0], orient_axis = 'X')
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
# Contributed to by PKHG, Meta Androcto, Noctumsolis, Lijenstina,
|
||||
# Contributed to by PKHG, Meta Androcto, Noctumsolis, Lijenstina,
|
||||
# Spivak Vladimir (cwolf3d)
|
||||
# Origunally an addon by Andy Houston
|
||||
|
||||
|
@ -50,10 +50,10 @@ import bpy
|
|||
|
||||
def Geodesic_contex_menu(self, context):
|
||||
bl_label = 'Change'
|
||||
|
||||
|
||||
obj = context.object
|
||||
layout = self.layout
|
||||
|
||||
|
||||
if 'GeodesicDome' in obj.keys():
|
||||
props = layout.operator("mesh.generate_geodesic_dome", text="Change Geodesic Dome")
|
||||
props.change = True
|
||||
|
|
|
@ -63,7 +63,7 @@ class GenerateGeodesicDome(Operator):
|
|||
bl_idname = "mesh.generate_geodesic_dome"
|
||||
bl_description = "Create Geodesic Object Types"
|
||||
bl_options = {'REGISTER', 'UNDO', 'PRESET'}
|
||||
|
||||
|
||||
# align_matrix for the invoke
|
||||
align_matrix : Matrix()
|
||||
|
||||
|
@ -74,14 +74,14 @@ class GenerateGeodesicDome(Operator):
|
|||
#### change properties
|
||||
name : StringProperty(name = "Name",
|
||||
description = "Name")
|
||||
|
||||
|
||||
change : BoolProperty(name = "Change",
|
||||
default = False,
|
||||
description = "change Gear")
|
||||
|
||||
delete : StringProperty(name = "Delete",
|
||||
description = "Delete Gear")
|
||||
|
||||
|
||||
location : FloatVectorProperty(name = "",
|
||||
description = "Location",
|
||||
default = (0.0, 0.0, 0.0),
|
||||
|
@ -1154,10 +1154,10 @@ class GenerateGeodesicDome(Operator):
|
|||
multi_label(help_text, box, text_width)
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
if self.change:
|
||||
ObjectDelete(self, context, self.delete)
|
||||
|
||||
|
||||
global last_generated_object, last_imported_mesh, basegeodesic, imported_hubmesh_to_use, error_message
|
||||
# default superformparam = [3, 10, 10, 10, 1, 1, 4, 10, 10, 10, 1, 1, 0, 0, 0.0, 0.0, 0, 0]]
|
||||
superformparam = [self.um, self.un1, self.un2, self.un3, self.ua,
|
||||
|
@ -1371,14 +1371,14 @@ class GenerateGeodesicDome(Operator):
|
|||
obj = bpy.data.objects[-1]
|
||||
obj.name = self.fmeshname
|
||||
#obj.location = (0, 0, 0)
|
||||
|
||||
|
||||
|
||||
|
||||
obj = context.active_object
|
||||
self.align_matrix = align_matrix(context, self.location)
|
||||
|
||||
|
||||
obj.matrix_world = self.align_matrix # apply matrix
|
||||
obj.rotation_euler = self.rotation_euler
|
||||
|
||||
|
||||
obj["GeodesicDome"] = True
|
||||
obj["change"] = False
|
||||
obj["delete"] = ""
|
||||
|
@ -1568,7 +1568,7 @@ class GenerateGeodesicDome(Operator):
|
|||
bpy.context.scene.cursor.location = self.startlocation
|
||||
else:
|
||||
self.startlocation = bpy.context.scene.cursor.location
|
||||
|
||||
|
||||
self.align_matrix = align_matrix(context, self.startlocation)
|
||||
self.execute(context)
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ def register():
|
|||
bpy.utils.register_class(AMTH_MESH_OT_find_asymmetric)
|
||||
bpy.utils.register_class(AMTH_MESH_OT_make_symmetric)
|
||||
bpy.types.VIEW3D_MT_edit_mesh.append(ui_symmetry_tools)
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_class(AMTH_MESH_OT_find_asymmetric)
|
||||
|
|
|
@ -149,15 +149,15 @@ def render_cycles_scene_samples(self, context):
|
|||
|
||||
if list_sampling:
|
||||
#if len(scene.render.layers) == 1 and render.layers[0].samples == 0:
|
||||
if len(scene.render.views) == 1 and render.view_layers[0].samples == 0:
|
||||
if len(scene.render.views) == 1 and render.view_layers[0].samples == 0:
|
||||
pass
|
||||
else:
|
||||
col.separator()
|
||||
#col.label(text="RenderLayers:", icon="RENDERLAYERS")
|
||||
col.label(text="View Layers:", icon="RENDERLAYERS")
|
||||
col.label(text="View Layers:", icon="RENDERLAYERS")
|
||||
|
||||
#for rl in scene.render.layers:
|
||||
for rl in scene.view_layers:
|
||||
for rl in scene.view_layers:
|
||||
row = col.row(align=True)
|
||||
row.label(text=rl.name, icon="BLANK1")
|
||||
row.prop(
|
||||
|
@ -178,7 +178,7 @@ def render_cycles_scene_samples(self, context):
|
|||
cscene = s.cycles
|
||||
|
||||
#row.label(s.name)
|
||||
row.label(text=s.name)
|
||||
row.label(text=s.name)
|
||||
row.prop(cscene, "samples", icon="BLANK1")
|
||||
else:
|
||||
row.label(
|
||||
|
|
|
@ -41,14 +41,14 @@ object as a new shape key.
|
|||
- Unpose-function reused from a script by Tal Trachtman in 2007
|
||||
http://www.apexbow.com/randd.html
|
||||
- Converted to Blender 2.5 by Ivo Grigull
|
||||
- Converted to Blender 2.8 by Tokikake
|
||||
("fast" option was removed, add new "delta" option
|
||||
- Converted to Blender 2.8 by Tokikake
|
||||
("fast" option was removed, add new "delta" option
|
||||
which count currently used shape key values of armature mesh when transfer)
|
||||
|
||||
Limitations and new delta option for 2.8
|
||||
- Target mesh may not have any transformation at object level,
|
||||
it will be set to zero.
|
||||
|
||||
|
||||
- new "delta" option usage, when you hope to make new shape-key with keep currently visible other shape keys value.
|
||||
it can generate new shape key, with value as 1.00. then deform target shape as source shape with keep other shape key values relative.
|
||||
|
||||
|
@ -69,11 +69,11 @@ threshold = 1e-16
|
|||
def update_mesh(ob):
|
||||
depth = bpy.context.evaluated_depsgraph_get()
|
||||
depth.update()
|
||||
ob.update_tag()
|
||||
bpy.context.view_layer.update()
|
||||
ob.update_tag()
|
||||
bpy.context.view_layer.update()
|
||||
ob.data.update()
|
||||
|
||||
|
||||
|
||||
|
||||
def reset_transform(ob):
|
||||
ob.matrix_local.identity()
|
||||
|
||||
|
@ -124,25 +124,25 @@ def func_add_corrective_pose_shape(source, target, flag):
|
|||
print(ob_1)
|
||||
print(ob_1.active_shape_key)
|
||||
active_key_name = ob_1.active_shape_key.name
|
||||
|
||||
|
||||
if (flag == True):
|
||||
# Make mix shape key from currently used shape keys
|
||||
# Make mix shape key from currently used shape keys
|
||||
if not key_index == 0:
|
||||
ob_1.active_shape_key.value = 0
|
||||
mix_shape = ob_1.shape_key_add(from_mix = True)
|
||||
mix_shape.name = "Mix_shape"
|
||||
update_mesh(ob_1)
|
||||
keys = ob_1.data.shape_keys.key_blocks.keys()
|
||||
keys = ob_1.data.shape_keys.key_blocks.keys()
|
||||
ob_1.active_shape_key_index = keys.index(active_key_name)
|
||||
|
||||
print("active_key_name: ", active_key_name)
|
||||
|
||||
|
||||
print("active_key_name: ", active_key_name)
|
||||
|
||||
if key_index == 0:
|
||||
new_shapekey = ob_1.shape_key_add()
|
||||
new_shapekey.name = "Shape_" + ob_2.name
|
||||
update_mesh(ob_1)
|
||||
keys = ob_1.data.shape_keys.key_blocks.keys()
|
||||
ob_1.active_shape_key_index = keys.index(new_shapekey.name)
|
||||
keys = ob_1.data.shape_keys.key_blocks.keys()
|
||||
ob_1.active_shape_key_index = keys.index(new_shapekey.name)
|
||||
|
||||
# else, the active shape will be used (updated)
|
||||
|
||||
|
@ -196,29 +196,29 @@ def func_add_corrective_pose_shape(source, target, flag):
|
|||
apply_vert_coords(ob_1, mesh_1_key_verts, x)
|
||||
|
||||
ob_1.show_only_shape_key = True
|
||||
|
||||
|
||||
if (flag == True):
|
||||
# remove delta of mix-shape key values from new shape key
|
||||
key_index = ob_1.active_shape_key_index
|
||||
active_key_name = ob_1.active_shape_key.name
|
||||
active_key_name = ob_1.active_shape_key.name
|
||||
shape_data = ob_1.active_shape_key.data
|
||||
mix_data = mix_shape.data
|
||||
mix_data = mix_shape.data
|
||||
for i in range(0, len(mesh_1.vertices)):
|
||||
shape_data[i].co = mesh_1.vertices[i].co + shape_data[i].co - mix_data[i].co
|
||||
shape_data[i].co = mesh_1.vertices[i].co + shape_data[i].co - mix_data[i].co
|
||||
update_mesh(ob_1)
|
||||
|
||||
|
||||
ob_1.active_shape_key_index = ob_1.data.shape_keys.key_blocks.keys().index("Mix_shape")
|
||||
bpy.ops.object.shape_key_remove()
|
||||
ob_1.active_shape_key_index = ob_1.data.shape_keys.key_blocks.keys().index(active_key_name)
|
||||
ob_1.data.update()
|
||||
ob_1.show_only_shape_key = False
|
||||
|
||||
|
||||
ob_1.active_shape_key.vertex_group = vgroup
|
||||
|
||||
# set the new shape key value to 1.0, so we see the result instantly
|
||||
ob_1.active_shape_key.value = 1.0
|
||||
update_mesh(ob_1)
|
||||
|
||||
update_mesh(ob_1)
|
||||
|
||||
|
||||
|
||||
class add_corrective_pose_shape(bpy.types.Operator):
|
||||
|
@ -244,13 +244,13 @@ class add_corrective_pose_shape(bpy.types.Operator):
|
|||
source = selection[1]
|
||||
else:
|
||||
source = selection[0]
|
||||
|
||||
|
||||
delta_flag = False
|
||||
|
||||
func_add_corrective_pose_shape(source, target, delta_flag)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class add_corrective_pose_shape_delta (bpy.types.Operator):
|
||||
"""Adds first object as shape to second object for the current pose """ \
|
||||
"""while maintaining modifiers and currently used other shape keys""" \
|
||||
|
@ -274,7 +274,7 @@ class add_corrective_pose_shape_delta (bpy.types.Operator):
|
|||
source = selection[1]
|
||||
else:
|
||||
source = selection[0]
|
||||
|
||||
|
||||
delta_flag = True
|
||||
|
||||
func_add_corrective_pose_shape(source, target, delta_flag)
|
||||
|
@ -431,7 +431,7 @@ def func_add_corrective_pose_shape_fast(source, target):
|
|||
verts = source.data.vertices
|
||||
for n in range(len(verts)):
|
||||
shape_key_verts[n].co = verts[n].co
|
||||
target.update_tag()
|
||||
target.update_tag()
|
||||
bpy.context.view_layer.update()
|
||||
# go to all armature modifies and unpose the shape
|
||||
for n in target.modifiers:
|
||||
|
@ -446,18 +446,18 @@ def func_add_corrective_pose_shape_fast(source, target):
|
|||
|
||||
# set the new shape key value to 1.0, so we see the result instantly
|
||||
target.active_shape_key.value = 1.0
|
||||
|
||||
|
||||
try:
|
||||
target.active_shape_key.vertex_group = vgroup
|
||||
except:
|
||||
pass
|
||||
|
||||
target.show_only_shape_key = False
|
||||
target.update_tag()
|
||||
target.update_tag()
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
|
||||
target.data.update()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -524,6 +524,6 @@ def unregister():
|
|||
unregister_class(cls)
|
||||
bpy.types.MESH_MT_shape_key_context_menu.remove(vgroups_draw)
|
||||
bpy.types.DATA_PT_modifiers.remove(modifiers_draw)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
|
|
@ -280,7 +280,7 @@ class GenerateThumbnailOperator(bpy.types.Operator):
|
|||
|
||||
bpy.context.window_manager.popup_menu(draw_message, title=title, icon='INFO')
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
return wm.invoke_props_dialog(self)
|
||||
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ class OBJECT_OT_objectconnect(Operator):
|
|||
bpy.ops.curve.btgrow()
|
||||
|
||||
bpy.data.collections["Btrace"].objects.link(curve) # add to Btrace collection
|
||||
|
||||
|
||||
# Check if we add grow curve
|
||||
if Btrace.animate:
|
||||
bpy.ops.curve.btgrow() # Add grow curve
|
||||
|
@ -312,7 +312,7 @@ class OBJECT_OT_particletrace(Operator):
|
|||
|
||||
if Btrace.curve_join:
|
||||
tracer = curvetracer('Tracer', 'Splines')
|
||||
|
||||
|
||||
for x in ps.particles:
|
||||
if not Btrace.curve_join:
|
||||
tracer = curvetracer('Tracer.000', 'Spline.000')
|
||||
|
@ -322,7 +322,7 @@ class OBJECT_OT_particletrace(Operator):
|
|||
spline.bezier_points.add((x.lifetime - 1) // particle_step)
|
||||
for t in list(range(int(x.lifetime))):
|
||||
bpy.context.scene.frame_set(t + x.birth_time)
|
||||
|
||||
|
||||
if not t % particle_step:
|
||||
p = spline.bezier_points[t // particle_step]
|
||||
p.co = x.location
|
||||
|
@ -813,7 +813,7 @@ class OBJECT_OT_meshfollow(Operator):
|
|||
if curveobject.type == 'CURVE':
|
||||
curveobject.select_set(True)
|
||||
bpy.context.view_layer.objects.active = curveobject
|
||||
|
||||
|
||||
bpy.data.collections["Btrace"].objects.link(curveobject) #2.8 link obj to collection
|
||||
bpy.context.scene.collection.objects.unlink(curveobject) # unlink from scene collection
|
||||
# bpy.ops.object.group_link(group="Btrace")
|
||||
|
@ -852,7 +852,7 @@ def addtracemat(matobj):
|
|||
matslots = bpy.context.object.data.materials.items()
|
||||
|
||||
if len(matslots) < 1: # Make sure there is only one material slot
|
||||
|
||||
|
||||
Btrace = bpy.context.window_manager.curve_tracer
|
||||
|
||||
# Check if color blender is to be run
|
||||
|
@ -909,14 +909,14 @@ def addtracemat(matobj):
|
|||
mat_color = Btrace.trace_mat_color
|
||||
|
||||
TraceMat = bpy.data.materials.new('TraceMat')
|
||||
|
||||
TraceMat.use_nodes = True
|
||||
|
||||
TraceMat.use_nodes = True
|
||||
BSDF = TraceMat.node_tree.nodes[1]
|
||||
r, g, b = mat_color[0], mat_color[1], mat_color[2]
|
||||
BSDF.inputs[0].default_value = [r, g, b, 1] # change node color
|
||||
TraceMat.diffuse_color = [r, g, b, 1] # change viewport color
|
||||
|
||||
|
||||
|
||||
|
||||
# Add material to object
|
||||
matobj.materials.append(bpy.data.materials.get(TraceMat.name))
|
||||
|
||||
|
|
|
@ -1059,7 +1059,7 @@ class AssignShapeKeysPanel(Panel):
|
|||
def draw(self, context):
|
||||
|
||||
layout = self.layout
|
||||
layout.label(text='Morph Curves:')
|
||||
layout.label(text='Morph Curves:')
|
||||
col = layout.column()
|
||||
params = context.window_manager.AssignShapeKeyParams
|
||||
|
||||
|
|
|
@ -596,66 +596,66 @@ def main_rd(context, distance = 0.01):
|
|||
selected_Curves = context.selected_objects
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
|
||||
for curve in selected_Curves:
|
||||
bezier_dellist = []
|
||||
dellist = []
|
||||
|
||||
for spline in curve.data.splines:
|
||||
|
||||
for spline in curve.data.splines:
|
||||
if spline.type == 'BEZIER':
|
||||
if len(spline.bezier_points) > 1:
|
||||
for i in range(0, len(spline.bezier_points)):
|
||||
|
||||
for i in range(0, len(spline.bezier_points)):
|
||||
|
||||
if i == 0:
|
||||
ii = len(spline.bezier_points) - 1
|
||||
else:
|
||||
else:
|
||||
ii = i - 1
|
||||
|
||||
|
||||
dot = spline.bezier_points[i];
|
||||
dot1 = spline.bezier_points[ii];
|
||||
|
||||
dot1 = spline.bezier_points[ii];
|
||||
|
||||
while dot1 in bezier_dellist and i != ii:
|
||||
ii -= 1
|
||||
if ii < 0:
|
||||
if ii < 0:
|
||||
ii = len(spline.bezier_points)-1
|
||||
dot1 = spline.bezier_points[ii]
|
||||
|
||||
if dot.select_control_point and dot1.select_control_point and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
|
||||
if dot.select_control_point and dot1.select_control_point and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
if (dot.co-dot1.co).length < distance:
|
||||
# remove points and recreate hangles
|
||||
dot1.handle_right_type = "FREE"
|
||||
dot1.handle_right = dot.handle_right
|
||||
dot1.co = (dot.co + dot1.co) / 2
|
||||
bezier_dellist.append(dot)
|
||||
|
||||
|
||||
else:
|
||||
# Handles that are on main point position converts to vector,
|
||||
# if next handle are also vector
|
||||
if dot.handle_left_type == 'VECTOR' and (dot1.handle_right - dot1.co).length < distance:
|
||||
dot1.handle_right_type = "VECTOR"
|
||||
if dot1.handle_right_type == 'VECTOR' and (dot.handle_left - dot.co).length < distance:
|
||||
dot.handle_left_type = "VECTOR"
|
||||
dot.handle_left_type = "VECTOR"
|
||||
else:
|
||||
if len(spline.points) > 1:
|
||||
for i in range(0, len(spline.points)):
|
||||
|
||||
for i in range(0, len(spline.points)):
|
||||
|
||||
if i == 0:
|
||||
ii = len(spline.points) - 1
|
||||
else:
|
||||
else:
|
||||
ii = i - 1
|
||||
|
||||
|
||||
dot = spline.points[i];
|
||||
dot1 = spline.points[ii];
|
||||
|
||||
dot1 = spline.points[ii];
|
||||
|
||||
while dot1 in dellist and i != ii:
|
||||
ii -= 1
|
||||
if ii < 0:
|
||||
if ii < 0:
|
||||
ii = len(spline.points)-1
|
||||
dot1 = spline.points[ii]
|
||||
|
||||
if dot.select and dot1.select and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
|
||||
if dot.select and dot1.select and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
if (dot.co-dot1.co).length < distance:
|
||||
dot1.co = (dot.co + dot1.co) / 2
|
||||
dellist.append(dot)
|
||||
|
@ -664,17 +664,17 @@ def main_rd(context, distance = 0.01):
|
|||
|
||||
for dot in bezier_dellist:
|
||||
dot.select_control_point = True
|
||||
|
||||
|
||||
for dot in dellist:
|
||||
dot.select = True
|
||||
|
||||
|
||||
bezier_count = len(bezier_dellist)
|
||||
count = len(dellist)
|
||||
|
||||
|
||||
bpy.ops.curve.delete(type = 'VERT')
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action = 'DESELECT')
|
||||
|
||||
|
||||
return bezier_count + count
|
||||
|
||||
|
||||
|
|
|
@ -345,11 +345,11 @@ class VIEW3D_PT_CurvePanel(Panel):
|
|||
row.operator("curvetools.scale_reset", text='Scale Reset')
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.operatorbirail", text="Birail")
|
||||
row = col.row(align=True)
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.convert_selected_face_to_bezier", text="Convert selected faces to Bezier")
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.convert_bezier_to_surface", text="Convert Bezier to Surface")
|
||||
|
||||
|
||||
# Extended options
|
||||
box1 = self.layout.box()
|
||||
col = box1.column(align=True)
|
||||
|
@ -363,9 +363,9 @@ class VIEW3D_PT_CurvePanel(Panel):
|
|||
row = col.row(align=True)
|
||||
row.operator("curvetools.bezier_cad_subdivide", text="Multi Subdivide")
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.split", text='Split by selected points')
|
||||
row.operator("curvetools.split", text='Split by selected points')
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.remove_doubles", text='Remove Doubles')
|
||||
row.operator("curvetools.remove_doubles", text='Remove Doubles')
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.add_toolpath_discretize_curve", text="Discretize Curve")
|
||||
row = col.row(align=True)
|
||||
|
@ -387,7 +387,7 @@ class VIEW3D_PT_CurvePanel(Panel):
|
|||
row.prop(context.scene.curvetools, "curve_vertcolor", text="")
|
||||
row = col.row(align=True)
|
||||
row.operator("curvetools.show_resolution", text="Run [ESC]")
|
||||
|
||||
|
||||
# D.1 set spline sequence
|
||||
row = col.row(align=True)
|
||||
row.label(text="Show and rearrange spline sequence:")
|
||||
|
@ -444,7 +444,7 @@ class VIEW3D_PT_CurvePanel(Panel):
|
|||
row.label(text="Alt + Shift + mouse click - add spline to select")
|
||||
row = col.row(align=True)
|
||||
row.label(text="A - deselect all")
|
||||
|
||||
|
||||
# Add-ons Preferences Update Panel
|
||||
|
||||
# Define Panel classes for updating
|
||||
|
@ -492,17 +492,17 @@ class CurveAddonPreferences(AddonPreferences):
|
|||
# Context MENU
|
||||
def curve_tools_context_menu(self, context):
|
||||
bl_label = 'Curve tools'
|
||||
|
||||
|
||||
self.layout.operator("curvetools.bezier_points_fillet", text="Fillet")
|
||||
self.layout.operator("curvetools.bezier_cad_handle_projection", text='Handle Projection')
|
||||
self.layout.operator("curvetools.bezier_spline_divide", text="Divide")
|
||||
self.layout.operator("curvetools.add_toolpath_offset_curve", text="Offset Curve")
|
||||
self.layout.operator("curvetools.remove_doubles", text='Remove Doubles')
|
||||
self.layout.separator()
|
||||
|
||||
|
||||
def curve_tools_object_context_menu(self, context):
|
||||
bl_label = 'Curve tools'
|
||||
|
||||
|
||||
if context.active_object.type == "CURVE":
|
||||
self.layout.operator("curvetools.scale_reset", text="Scale Reset")
|
||||
self.layout.operator("curvetools.add_toolpath_offset_curve", text="Offset Curve")
|
||||
|
@ -566,21 +566,21 @@ def register():
|
|||
default=True,
|
||||
description="Curves Utils"
|
||||
)
|
||||
|
||||
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
for panel in panels:
|
||||
bpy.utils.register_class(panel)
|
||||
|
||||
|
||||
auto_loft.register()
|
||||
|
||||
|
||||
bpy.types.TOPBAR_MT_file_export.append(menu_file_export)
|
||||
|
||||
|
||||
bpy.types.Scene.curvetools = bpy.props.PointerProperty(type=curvetoolsSettings)
|
||||
|
||||
|
||||
update_panel(None, bpy.context)
|
||||
|
||||
|
||||
bpy.types.VIEW3D_MT_edit_curve_context_menu.prepend(curve_tools_context_menu)
|
||||
bpy.types.VIEW3D_MT_object_context_menu.prepend(curve_tools_object_context_menu)
|
||||
|
||||
|
@ -592,17 +592,17 @@ def unregister():
|
|||
del bpy.types.Scene.UTAdvancedDrop
|
||||
del bpy.types.Scene.UTExtendedDrop
|
||||
del bpy.types.Scene.UTUtilsDrop
|
||||
|
||||
|
||||
auto_loft.unregister()
|
||||
|
||||
|
||||
bpy.types.TOPBAR_MT_file_export.remove(menu_file_export)
|
||||
|
||||
|
||||
bpy.types.VIEW3D_MT_edit_curve_context_menu.remove(curve_tools_context_menu)
|
||||
bpy.types.VIEW3D_MT_object_context_menu.remove(curve_tools_object_context_menu)
|
||||
|
||||
|
||||
for panel in panels:
|
||||
bpy.utils.unregister_class(panel)
|
||||
|
||||
|
||||
for cls in classes:
|
||||
bpy.utils.unregister_class(cls)
|
||||
|
||||
|
|
|
@ -70,9 +70,9 @@ class Boolean(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
current_mode = bpy.context.object.mode
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
if bpy.context.object.data.dimensions != '2D':
|
||||
self.report({'WARNING'}, 'Can only be applied in 2D')
|
||||
return {'CANCELLED'}
|
||||
|
@ -86,9 +86,9 @@ class Boolean(bpy.types.Operator):
|
|||
if not internal.bezierBooleanGeometry(splineA, splineB, self.operation):
|
||||
self.report({'WARNING'}, 'Invalid selection. Only work to selected two spline.')
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
bpy.ops.object.mode_set (mode = current_mode)
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
class Intersection(bpy.types.Operator):
|
||||
|
@ -108,7 +108,7 @@ class Intersection(bpy.types.Operator):
|
|||
|
||||
internal.bezierMultiIntersection(segments)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class HandleProjection(bpy.types.Operator):
|
||||
bl_idname = 'curvetools.bezier_cad_handle_projection'
|
||||
bl_description = bl_label = 'Handle Projection'
|
||||
|
@ -191,7 +191,7 @@ class Subdivide(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
current_mode = bpy.context.object.mode
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
segments = internal.bezierSegments(bpy.context.object.data.splines, True)
|
||||
|
@ -206,7 +206,7 @@ class Subdivide(bpy.types.Operator):
|
|||
for segment in segments:
|
||||
segment['cuts'].extend(cuts)
|
||||
internal.subdivideBezierSegments(segments)
|
||||
|
||||
|
||||
bpy.ops.object.mode_set (mode = current_mode)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ def remove_handler(handlers):
|
|||
except:
|
||||
pass
|
||||
for handler in handlers:
|
||||
handlers.remove(handler)
|
||||
handlers.remove(handler)
|
||||
|
||||
|
||||
class Fillet(bpy.types.Operator):
|
||||
|
@ -55,44 +55,44 @@ class Fillet(bpy.types.Operator):
|
|||
bl_label = "Curve Fillet"
|
||||
bl_description = "Curve Fillet"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
|
||||
x: IntProperty(name="x", description="x")
|
||||
y: IntProperty(name="y", description="y")
|
||||
location3D: FloatVectorProperty(name = "",
|
||||
description = "Start location",
|
||||
default = (0.0, 0.0, 0.0),
|
||||
subtype = 'XYZ')
|
||||
|
||||
|
||||
handlers = []
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
self.report({'INFO'}, "ESC or TAB - cancel")
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# color change in the panel
|
||||
self.path_color = bpy.context.scene.curvetools.path_color
|
||||
self.path_thickness = bpy.context.scene.curvetools.path_thickness
|
||||
|
||||
def modal(self, context, event):
|
||||
context.area.tag_redraw()
|
||||
|
||||
|
||||
if event.type in {'ESC', 'TAB'}: # Cancel
|
||||
remove_handler(self.handlers)
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
if event.type in {'X', 'DEL'}: # Cancel
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
elif event.alt and event.shift and event.type == 'LEFTMOUSE':
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.alt and not event.shift and event.type == 'LEFTMOUSE':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.alt and event.type == 'RIGHTMOUSE':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
@ -100,12 +100,12 @@ class Fillet(bpy.types.Operator):
|
|||
|
||||
elif event.alt and not event.shift and event.shift and event.type == 'RIGHTMOUSE':
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.type == 'A':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
elif event.type == 'MOUSEMOVE': #
|
||||
|
||||
elif event.type == 'MOUSEMOVE': #
|
||||
self.x = event.mouse_x
|
||||
self.y = event.mouse_y
|
||||
region = bpy.context.region
|
||||
|
@ -115,7 +115,7 @@ class Fillet(bpy.types.Operator):
|
|||
rv3d,
|
||||
(event.mouse_region_x, event.mouse_region_y),
|
||||
(0.0, 0.0, 0.0)
|
||||
)
|
||||
)
|
||||
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Fillet(bpy.types.Operator):
|
|||
self.execute(context)
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.object is not None and
|
||||
|
|
|
@ -151,8 +151,8 @@ class OperatorOriginToSpline0Start(bpy.types.Operator):
|
|||
|
||||
|
||||
def execute(self, context):
|
||||
|
||||
|
||||
|
||||
|
||||
blCurve = context.active_object
|
||||
blSpline = blCurve.data.splines[0]
|
||||
newOrigin = blCurve.matrix_world @ blSpline.bezier_points[0].co
|
||||
|
@ -162,12 +162,12 @@ class OperatorOriginToSpline0Start(bpy.types.Operator):
|
|||
self.report({'INFO'}, "newOrigin: %.6f, %.6f, %.6f" % (newOrigin.x, newOrigin.y, newOrigin.z))
|
||||
|
||||
current_mode = bpy.context.object.mode
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
bpy.context.scene.cursor.location = newOrigin
|
||||
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
|
||||
bpy.context.scene.cursor.location = origOrigin
|
||||
|
||||
|
||||
bpy.ops.object.mode_set (mode = current_mode)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -212,16 +212,16 @@ class OperatorIntersectCurves(bpy.types.Operator):
|
|||
bpy.ops.object.select_all(action='DESELECT')
|
||||
selected_objects[i].select_set(True)
|
||||
selected_objects[j].select_set(True)
|
||||
|
||||
|
||||
if selected_objects[i].type == 'CURVE' and selected_objects[j].type == 'CURVE':
|
||||
curveIntersector = intersections.CurvesIntersector.FromSelection()
|
||||
rvIntersectionNrs = curveIntersector.CalcAndApplyIntersections()
|
||||
|
||||
self.report({'INFO'}, "Active curve points: %d; other curve points: %d" % (rvIntersectionNrs[0], rvIntersectionNrs[1]))
|
||||
|
||||
|
||||
for obj in selected_objects:
|
||||
obj.select_set(True)
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
|
@ -415,14 +415,14 @@ class OperatorSplinesJoinNeighbouring(bpy.types.Operator):
|
|||
self.report({'INFO'}, "Applied %d joins on %d splines; resulting nrSplines: %d" % (nrJoins, nrSplines, curve.nrSplines))
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# SurfaceFromBezier
|
||||
|
||||
def SurfaceFromBezier(surfacedata, points, center):
|
||||
|
||||
|
||||
len_points = len(points) - 1
|
||||
|
||||
|
||||
if len_points % 2 == 0:
|
||||
h = mathematics.subdivide_cubic_bezier(
|
||||
points[len_points].co, points[len_points].handle_right,
|
||||
|
@ -435,7 +435,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
points[len_points].co = h[2]
|
||||
points[len_points].handle_right = h[3]
|
||||
points[0].handle_left = h[4]
|
||||
|
||||
|
||||
half = round((len_points + 1)/2) - 1
|
||||
# 1
|
||||
surfacespline1 = surfacedata.splines.new(type='NURBS')
|
||||
|
@ -450,7 +450,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
surfacespline1.use_endpoint_v = True
|
||||
|
||||
for i in range(0, half):
|
||||
|
||||
|
||||
if center:
|
||||
# 2
|
||||
surfacespline2 = surfacedata.splines.new(type='NURBS')
|
||||
|
@ -467,7 +467,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
p.select = True
|
||||
surfacespline2.use_endpoint_u = True
|
||||
surfacespline2.use_endpoint_v = True
|
||||
|
||||
|
||||
# 3
|
||||
surfacespline3 = surfacedata.splines.new(type='NURBS')
|
||||
surfacespline3.points.add(3)
|
||||
|
@ -483,7 +483,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
p.select = True
|
||||
surfacespline3.use_endpoint_u = True
|
||||
surfacespline3.use_endpoint_v = True
|
||||
|
||||
|
||||
# 4
|
||||
surfacespline4 = surfacedata.splines.new(type='NURBS')
|
||||
surfacespline4.points.add(3)
|
||||
|
@ -499,7 +499,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
p.select = True
|
||||
surfacespline4.use_endpoint_u = True
|
||||
surfacespline4.use_endpoint_v = True
|
||||
|
||||
|
||||
if center:
|
||||
# 5
|
||||
surfacespline5 = surfacedata.splines.new(type='NURBS')
|
||||
|
@ -516,7 +516,7 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
p.select = True
|
||||
surfacespline5.use_endpoint_u = True
|
||||
surfacespline5.use_endpoint_v = True
|
||||
|
||||
|
||||
# 6
|
||||
surfacespline6 = surfacedata.splines.new(type='NURBS')
|
||||
surfacespline6.points.add(3)
|
||||
|
@ -528,10 +528,10 @@ def SurfaceFromBezier(surfacedata, points, center):
|
|||
p.select = True
|
||||
surfacespline6.use_endpoint_u = True
|
||||
surfacespline6.use_endpoint_v = True
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
bpy.ops.curve.make_segment()
|
||||
|
||||
|
||||
for s in surfacedata.splines:
|
||||
s.resolution_u = 4
|
||||
s.resolution_v = 4
|
||||
|
@ -561,7 +561,7 @@ class ConvertSelectedFacesToBezier(bpy.types.Operator):
|
|||
curvedata = bpy.data.curves.new('Curve' + active_object.name, type='CURVE')
|
||||
curveobject = object_utils.object_data_add(context, curvedata)
|
||||
curvedata.dimensions = '3D'
|
||||
|
||||
|
||||
for poly in meshdata.polygons:
|
||||
if poly.select:
|
||||
newSpline = curvedata.splines.new(type='BEZIER')
|
||||
|
@ -576,9 +576,9 @@ class ConvertSelectedFacesToBezier(bpy.types.Operator):
|
|||
newSpline.bezier_points[npoint].select_left_handle = True
|
||||
newSpline.bezier_points[npoint].select_right_handle = True
|
||||
npoint += 1
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Convert Bezier to Surface
|
||||
|
||||
|
@ -593,7 +593,7 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
default=False,
|
||||
description="Consider center points"
|
||||
)
|
||||
|
||||
|
||||
Resolution_U: IntProperty(
|
||||
name="Resolution_U",
|
||||
default=4,
|
||||
|
@ -601,7 +601,7 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
soft_min=1,
|
||||
description="Surface resolution U"
|
||||
)
|
||||
|
||||
|
||||
Resolution_V: IntProperty(
|
||||
name="Resolution_V",
|
||||
default=4,
|
||||
|
@ -609,7 +609,7 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
soft_min=1,
|
||||
description="Surface resolution V"
|
||||
)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -618,17 +618,17 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
col.prop(self, 'Center')
|
||||
col.prop(self, 'Resolution_U')
|
||||
col.prop(self, 'Resolution_V')
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return util.Selected1OrMoreCurves()
|
||||
|
||||
def execute(self, context):
|
||||
# main function
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
active_object = context.active_object
|
||||
curvedata = active_object.data
|
||||
|
||||
|
||||
surfacedata = bpy.data.curves.new('Surface', type='SURFACE')
|
||||
surfaceobject = object_utils.object_data_add(context, surfacedata)
|
||||
surfaceobject.matrix_world = active_object.matrix_world
|
||||
|
@ -636,10 +636,10 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
surfacedata.dimensions = '3D'
|
||||
surfaceobject.show_wire = True
|
||||
surfaceobject.show_in_front = True
|
||||
|
||||
|
||||
for spline in curvedata.splines:
|
||||
SurfaceFromBezier(surfacedata, spline.bezier_points, self.Center)
|
||||
|
||||
|
||||
for spline in surfacedata.splines:
|
||||
len_p = len(spline.points)
|
||||
len_devide_4 = round(len_p / 4) + 1
|
||||
|
@ -648,12 +648,12 @@ class ConvertBezierToSurface(bpy.types.Operator):
|
|||
for point_index in range(len_devide_4, len_p - len_devide_4):
|
||||
if point_index != len_devide_2 and point_index != len_devide_2 - 1:
|
||||
spline.points[point_index].select = True
|
||||
|
||||
|
||||
surfacedata.resolution_u = self.Resolution_U
|
||||
surfacedata.resolution_v = self.Resolution_V
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Fillet
|
||||
|
||||
|
@ -693,10 +693,10 @@ class BezierPointsFillet(bpy.types.Operator):
|
|||
# main function
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
|
||||
splines = bpy.context.object.data.splines
|
||||
bpy.ops.curve.spline_type_set(type='BEZIER')
|
||||
|
||||
|
||||
bpy.ops.curve.handle_type_set(type='VECTOR')
|
||||
s = []
|
||||
for spline in splines:
|
||||
|
@ -719,9 +719,9 @@ class BezierPointsFillet(bpy.types.Operator):
|
|||
jn = 0
|
||||
for j in ii:
|
||||
j += jn
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
|
||||
if j != 0 and j != n - 1:
|
||||
bezier_points[j].select_control_point = True
|
||||
bezier_points[j + 1].select_control_point = True
|
||||
|
@ -730,7 +730,7 @@ class BezierPointsFillet(bpy.types.Operator):
|
|||
bezier_points[j + 1], bezier_points[j + 2]]
|
||||
jn += 1
|
||||
n += 1
|
||||
|
||||
|
||||
elif j == 0:
|
||||
bezier_points[j].select_control_point = True
|
||||
bezier_points[j + 1].select_control_point = True
|
||||
|
@ -739,14 +739,14 @@ class BezierPointsFillet(bpy.types.Operator):
|
|||
bezier_points[1], bezier_points[2]]
|
||||
jn += 1
|
||||
n += 1
|
||||
|
||||
|
||||
elif j == n - 1:
|
||||
bezier_points[j].select_control_point = True
|
||||
bezier_points[j - 1].select_control_point = True
|
||||
bpy.ops.curve.subdivide()
|
||||
selected4 = [bezier_points[0], bezier_points[n],
|
||||
bezier_points[n - 1], bezier_points[n - 2]]
|
||||
|
||||
|
||||
selected4[2].co = selected4[1].co
|
||||
s1 = Vector(selected4[0].co) - Vector(selected4[1].co)
|
||||
s2 = Vector(selected4[3].co) - Vector(selected4[2].co)
|
||||
|
@ -756,7 +756,7 @@ class BezierPointsFillet(bpy.types.Operator):
|
|||
s2.normalize()
|
||||
s22 = Vector(selected4[2].co) + s2 * self.Fillet_radius
|
||||
selected4[2].co = s22
|
||||
|
||||
|
||||
if self.Fillet_Type == 'Round':
|
||||
if j != n - 1:
|
||||
selected4[2].handle_right_type = 'VECTOR'
|
||||
|
@ -829,9 +829,9 @@ class BezierDivide(bpy.types.Operator):
|
|||
if n > 2:
|
||||
jn = 0
|
||||
for j in ii:
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
|
||||
if (j in ii) and (j + 1 in ii):
|
||||
bezier_points[j + jn].select_control_point = True
|
||||
bezier_points[j + 1 + jn].select_control_point = True
|
||||
|
@ -850,7 +850,7 @@ class BezierDivide(bpy.types.Operator):
|
|||
bezier_points[j + 2 + jn].handle_left_type = 'FREE'
|
||||
bezier_points[j + 2 + jn].handle_left = h[4]
|
||||
jn += 1
|
||||
|
||||
|
||||
if j == n - 1 and (0 in ii) and spline.use_cyclic_u:
|
||||
bezier_points[j + jn].select_control_point = True
|
||||
bezier_points[0].select_control_point = True
|
||||
|
@ -867,12 +867,12 @@ class BezierDivide(bpy.types.Operator):
|
|||
bezier_points[j + 1 + jn].handle_right_type = 'FREE'
|
||||
bezier_points[j + 1 + jn].handle_right = h[3]
|
||||
bezier_points[0].handle_left_type = 'FREE'
|
||||
bezier_points[0].handle_left = h[4]
|
||||
bezier_points[0].handle_left = h[4]
|
||||
|
||||
sn += 1
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# CurveScaleReset Operator
|
||||
|
||||
|
@ -890,25 +890,25 @@ class CurveScaleReset(bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
# main function
|
||||
current_mode = bpy.context.object.mode
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
|
||||
|
||||
oldCurve = context.active_object
|
||||
oldCurveName = oldCurve.name
|
||||
|
||||
|
||||
bpy.ops.object.duplicate_move(OBJECT_OT_duplicate=None, TRANSFORM_OT_translate=None)
|
||||
newCurve = context.active_object
|
||||
newCurve.data.splines.clear()
|
||||
newCurve.scale = (1.0, 1.0, 1.0)
|
||||
|
||||
|
||||
oldCurve.select_set(True)
|
||||
newCurve.select_set(True)
|
||||
bpy.context.view_layer.objects.active = newCurve
|
||||
bpy.ops.object.join()
|
||||
|
||||
|
||||
joinCurve = context.active_object
|
||||
joinCurve.name = oldCurveName
|
||||
|
||||
|
||||
bpy.ops.object.mode_set (mode = current_mode)
|
||||
|
||||
return {'FINISHED'}
|
||||
|
@ -927,7 +927,7 @@ class Split(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
selected_Curves = util.GetSelectedCurves()
|
||||
|
||||
|
||||
for curve in selected_Curves:
|
||||
spline_points = []
|
||||
select_points = {}
|
||||
|
@ -942,7 +942,7 @@ class Split(bpy.types.Operator):
|
|||
for i in range(len(spline.bezier_points)):
|
||||
bezier_point = spline.bezier_points[i]
|
||||
points[i]=[bezier_point.co[:], bezier_point.handle_left[:], bezier_point.handle_right[:]]
|
||||
|
||||
|
||||
if spline.bezier_points[i].select_control_point:
|
||||
select_bezier_points[i_bp].append(i)
|
||||
i_bp+=1
|
||||
|
@ -957,24 +957,24 @@ class Split(bpy.types.Operator):
|
|||
select_points[i_p].append(i)
|
||||
i_p+=1
|
||||
spline_points.append(points)
|
||||
|
||||
|
||||
curve.data.splines.clear()
|
||||
|
||||
|
||||
for key in select_bezier_points:
|
||||
|
||||
|
||||
num=0
|
||||
|
||||
|
||||
if select_bezier_points[key][-1] == select_bezier_points[key][0]-1:
|
||||
select_bezier_points[key].pop()
|
||||
|
||||
|
||||
for i in select_bezier_points[key][1:]+[select_bezier_points[key][0]-1]:
|
||||
if i != 0:
|
||||
spline = curve.data.splines.new('BEZIER')
|
||||
spline.bezier_points.add(i-num)
|
||||
|
||||
|
||||
for j in range(num, i):
|
||||
bezier_point = spline.bezier_points[j-num]
|
||||
|
||||
|
||||
bezier_point.co = bezier_spline_points[key][j][0]
|
||||
bezier_point.handle_left = bezier_spline_points[key][j][1]
|
||||
bezier_point.handle_right = bezier_spline_points[key][j][2]
|
||||
|
@ -983,29 +983,29 @@ class Split(bpy.types.Operator):
|
|||
bezier_point.handle_left = bezier_spline_points[key][i][1]
|
||||
bezier_point.handle_right = bezier_spline_points[key][i][2]
|
||||
num=i
|
||||
|
||||
|
||||
for key in select_points:
|
||||
|
||||
|
||||
num=0
|
||||
|
||||
|
||||
if select_points[key][-1] == select_points[key][0]-1:
|
||||
select_points[key].pop()
|
||||
|
||||
|
||||
for i in select_points[key][1:]+[select_points[key][0]-1]:
|
||||
if i != 0:
|
||||
spline = curve.data.splines.new(spline_points[key][i][1])
|
||||
spline.points.add(i-num)
|
||||
|
||||
|
||||
for j in range(num, i):
|
||||
point = spline.points[j-num]
|
||||
|
||||
|
||||
point.co = spline_points[key][j][0]
|
||||
point = spline.points[-1]
|
||||
point.co = spline_points[key][i][0]
|
||||
num=i
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SeparateOutline(bpy.types.Operator):
|
||||
bl_idname = "curvetools.sep_outline"
|
||||
bl_label = "Separate Outline"
|
||||
|
@ -1021,7 +1021,7 @@ class SeparateOutline(bpy.types.Operator):
|
|||
bpy.ops.curve.separate()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class CurveBoolean(bpy.types.Operator):
|
||||
bl_idname = "curvetools.bezier_curve_boolean"
|
||||
bl_description = "Curve Boolean"
|
||||
|
@ -1043,7 +1043,7 @@ class CurveBoolean(bpy.types.Operator):
|
|||
@classmethod
|
||||
def poll(cls, context):
|
||||
return util.Selected1OrMoreCurves()
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
@ -1055,27 +1055,27 @@ class CurveBoolean(bpy.types.Operator):
|
|||
|
||||
def execute(self, context):
|
||||
current_mode = bpy.context.object.mode
|
||||
|
||||
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode = 'OBJECT')
|
||||
|
||||
|
||||
selected_Curves = util.GetSelectedCurves()
|
||||
len_selected_curves = len(selected_Curves)
|
||||
if len_selected_curves < 2:
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
min_number = 1
|
||||
|
||||
|
||||
max_number = 0
|
||||
for iCurve in range(0, len_selected_curves):
|
||||
len_splines = len(selected_Curves[iCurve].data.splines)
|
||||
max_number += len_splines
|
||||
|
||||
|
||||
if self.number < min_number:
|
||||
self.number = min_number
|
||||
if self.number > max_number:
|
||||
self.number = max_number
|
||||
|
||||
|
||||
j = 0
|
||||
first_curve = 0
|
||||
first_spline = 0
|
||||
|
@ -1086,14 +1086,14 @@ class CurveBoolean(bpy.types.Operator):
|
|||
first_curve = iCurve
|
||||
first_spline = iSpline
|
||||
j += 1
|
||||
|
||||
|
||||
bpy.ops.object.select_all(action='DESELECT')
|
||||
|
||||
|
||||
spline1 = selected_Curves[first_curve].data.splines[first_spline]
|
||||
matrix_world1 = selected_Curves[first_curve].matrix_world
|
||||
|
||||
|
||||
len_spline1 = len(spline1.bezier_points)
|
||||
|
||||
|
||||
dataCurve = bpy.data.curves.new(self.operation, type='CURVE')
|
||||
dataCurve.dimensions = '2D'
|
||||
newSpline1 = dataCurve.splines.new(type='BEZIER')
|
||||
|
@ -1105,7 +1105,7 @@ class CurveBoolean(bpy.types.Operator):
|
|||
newSpline1.bezier_points[n].handle_left = matrix_world1 @ spline1.bezier_points[n].handle_left
|
||||
newSpline1.bezier_points[n].handle_right_type = spline1.bezier_points[n].handle_right_type
|
||||
newSpline1.bezier_points[n].handle_right = matrix_world1 @ spline1.bezier_points[n].handle_right
|
||||
|
||||
|
||||
Curve = object_utils.object_data_add(context, dataCurve)
|
||||
bpy.context.view_layer.objects.active = Curve
|
||||
Curve.select_set(True)
|
||||
|
@ -1129,7 +1129,7 @@ class CurveBoolean(bpy.types.Operator):
|
|||
newSpline.bezier_points[n].handle_left = matrix_world @ spline.bezier_points[n].handle_left
|
||||
newSpline.bezier_points[n].handle_right_type = spline.bezier_points[n].handle_right_type
|
||||
newSpline.bezier_points[n].handle_right = matrix_world @ spline.bezier_points[n].handle_right
|
||||
|
||||
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
bpy.ops.curve.select_all(action='SELECT')
|
||||
splines = internal.getSelectedSplines(True, True)
|
||||
|
@ -1138,15 +1138,15 @@ class CurveBoolean(bpy.types.Operator):
|
|||
splineA = splines[0]
|
||||
splineB = splines[1]
|
||||
dataCurve.splines.active = newSpline1
|
||||
|
||||
|
||||
if not internal.bezierBooleanGeometry(splineA, splineB, self.operation):
|
||||
self.report({'WARNING'}, 'Invalid selection.')
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
j += 1
|
||||
|
||||
|
||||
bpy.ops.object.mode_set (mode = current_mode)
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
def register():
|
||||
|
|
|
@ -44,49 +44,49 @@ def createOutline(curve, outline):
|
|||
if len(p) < 2:
|
||||
return
|
||||
out = []
|
||||
|
||||
|
||||
n = ((p[0].handle_right - p[0].co).normalized() - (p[0].handle_left - p[0].co).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = p[0].co + outline * n
|
||||
out.append(o)
|
||||
|
||||
|
||||
for i in range(1,len(p)-1):
|
||||
n = ((p[i].handle_right - p[i].co).normalized() - (p[i].handle_left - p[i].co).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = intersect_line_line(out[-1], (out[-1]+p[i].co - p[i-1].co), p[i].co, p[i].co + n)[0]
|
||||
out.append(o)
|
||||
|
||||
|
||||
n = ((p[-1].handle_right - p[-1].co).normalized() - (p[-1].handle_left - p[-1].co).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = p[-1].co + outline * n
|
||||
out.append(o)
|
||||
|
||||
|
||||
curve.data.splines.new(spline.type)
|
||||
if spline.use_cyclic_u:
|
||||
curve.data.splines[-1].use_cyclic_u = True
|
||||
p_out = curve.data.splines[-1].bezier_points
|
||||
p_out.add(len(out)-1)
|
||||
|
||||
|
||||
for i in range(len(out)):
|
||||
p_out[i].handle_left_type = 'FREE'
|
||||
p_out[i].handle_right_type = 'FREE'
|
||||
|
||||
|
||||
p_out[i].co = out[i]
|
||||
|
||||
|
||||
if i<len(out)-1:
|
||||
l = (p[i + 1].co - p[i].co).length
|
||||
l2 = (out[i] - out[i + 1]).length
|
||||
|
||||
|
||||
if i==0:
|
||||
p_out[i].handle_left = out[i] + ((p[i].handle_left - p[i].co) * l2/l)
|
||||
if i<len(out)-1:
|
||||
p_out[i + 1].handle_left = out[i + 1] + ((p[i + 1].handle_left - p[i + 1].co) * l2/l)
|
||||
p_out[i].handle_right = out[i] + ((p[i].handle_right - p[i].co) * l2/l)
|
||||
|
||||
|
||||
for i in range(len(p)):
|
||||
p_out[i].handle_left_type = p[i].handle_left_type
|
||||
p_out[i].handle_right_type = p[i].handle_right_type
|
||||
|
||||
|
||||
else:
|
||||
if len(spline.points) < 2:
|
||||
return
|
||||
|
@ -95,32 +95,32 @@ def createOutline(curve, outline):
|
|||
v = Vector((point.co[0], point.co[1], point.co[2]))
|
||||
p.append(v)
|
||||
out = []
|
||||
|
||||
|
||||
n = ((p[1] - p[0]).normalized() - (p[-1] - p[0]).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = p[0] + outline * n
|
||||
out.append(o)
|
||||
|
||||
|
||||
for i in range(1,len(p)-1):
|
||||
n = ((p[i+1] - p[i]).normalized() - (p[i-1] - p[i]).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = intersect_line_line(out[-1], (out[-1]+p[i] - p[i-1]), p[i], p[i] + n)[0]
|
||||
out.append(o)
|
||||
|
||||
|
||||
n = ((p[0] - p[-1]).normalized() - (p[-2] - p[-1]).normalized()).normalized()
|
||||
n = Vector((-n[1], n[0], n[2]))
|
||||
o = p[-1] + outline * n
|
||||
out.append(o)
|
||||
|
||||
|
||||
curve.data.splines.new(spline.type)
|
||||
if spline.use_cyclic_u:
|
||||
curve.data.splines[-1].use_cyclic_u = True
|
||||
p_out = curve.data.splines[-1].points
|
||||
p_out.add(len(out)-1)
|
||||
|
||||
for i in range(len(out)):
|
||||
|
||||
for i in range(len(out)):
|
||||
p_out[i].co = (out[i][0], out[i][1], out[i][2], 0.0)
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ bl_info = {
|
|||
'wiki_url': '',
|
||||
'tracker_url': '',
|
||||
'category': 'Curve'}
|
||||
|
||||
|
||||
import time
|
||||
import threading
|
||||
|
||||
|
@ -69,7 +69,7 @@ def get_bezier_points(spline, matrix_world):
|
|||
point_list.extend([matrix_world @ spline.bezier_points[0].co])
|
||||
|
||||
return point_list
|
||||
|
||||
|
||||
def get_points(spline, matrix_world):
|
||||
point_list = []
|
||||
len_points = len(spline.points)
|
||||
|
@ -92,25 +92,25 @@ def get_points(spline, matrix_world):
|
|||
return point_list
|
||||
|
||||
def draw_bezier_points(self, context, spline, matrix_world, path_color, path_thickness):
|
||||
|
||||
|
||||
points = get_bezier_points(spline, matrix_world)
|
||||
|
||||
|
||||
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
||||
batch = batch_for_shader(shader, 'POINTS', {"pos": points})
|
||||
|
||||
|
||||
shader.bind()
|
||||
shader.uniform_float("color", path_color)
|
||||
bgl.glEnable(bgl.GL_BLEND)
|
||||
bgl.glLineWidth(path_thickness)
|
||||
batch.draw(shader)
|
||||
|
||||
|
||||
def draw_points(self, context, spline, matrix_world, path_color, path_thickness):
|
||||
|
||||
|
||||
points = get_points(spline, matrix_world)
|
||||
|
||||
|
||||
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
||||
batch = batch_for_shader(shader, 'POINTS', {"pos": points})
|
||||
|
||||
|
||||
shader.bind()
|
||||
shader.uniform_float("color", path_color)
|
||||
bgl.glEnable(bgl.GL_BLEND)
|
||||
|
@ -131,7 +131,7 @@ def near(location3D, point, radius):
|
|||
factor += 1
|
||||
if point.z < (location3D.z + radius):
|
||||
factor += 1
|
||||
|
||||
|
||||
return factor
|
||||
|
||||
def click(self, context, event):
|
||||
|
@ -141,9 +141,9 @@ def click(self, context, event):
|
|||
matrix_world = object.matrix_world
|
||||
if object.type == 'CURVE':
|
||||
curvedata = object.data
|
||||
|
||||
|
||||
radius = bpy.context.scene.curvetools.PathFinderRadius
|
||||
|
||||
|
||||
for spline in curvedata.splines:
|
||||
len_bezier_points = len(spline.bezier_points)
|
||||
factor_max = 0
|
||||
|
@ -153,7 +153,7 @@ def click(self, context, event):
|
|||
factor = near(self.location3D, co, radius)
|
||||
if factor > factor_max:
|
||||
factor_max = factor
|
||||
|
||||
|
||||
if i < len_bezier_points - 1:
|
||||
for t in range(0, 100, 2):
|
||||
h = mathematics.subdivide_cubic_bezier(spline.bezier_points[i].co,
|
||||
|
@ -186,7 +186,7 @@ def click(self, context, event):
|
|||
bezier_point.select_control_point = True
|
||||
bezier_point.select_left_handle = True
|
||||
bezier_point.select_right_handle = True
|
||||
|
||||
|
||||
for spline in curvedata.splines:
|
||||
len_points = len(spline.points)
|
||||
factor_max = 0
|
||||
|
@ -219,7 +219,7 @@ def click(self, context, event):
|
|||
if factor_max == 6:
|
||||
args = (self, context, spline, matrix_world, self.path_color, self.path_thickness)
|
||||
self.handlers.append(bpy.types.SpaceView3D.draw_handler_add(draw_points, args, 'WINDOW', 'POST_VIEW'))
|
||||
|
||||
|
||||
for point in spline.points:
|
||||
point.select = True
|
||||
|
||||
|
@ -230,51 +230,51 @@ def remove_handler(handlers):
|
|||
except:
|
||||
pass
|
||||
for handler in handlers:
|
||||
handlers.remove(handler)
|
||||
handlers.remove(handler)
|
||||
|
||||
class PathFinder(bpy.types.Operator):
|
||||
bl_idname = "curvetools.pathfinder"
|
||||
bl_label = "Path Finder"
|
||||
bl_description = "Path Finder"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
|
||||
x: IntProperty(name="x", description="x")
|
||||
y: IntProperty(name="y", description="y")
|
||||
location3D: FloatVectorProperty(name = "",
|
||||
description = "Start location",
|
||||
default = (0.0, 0.0, 0.0),
|
||||
subtype = 'XYZ')
|
||||
|
||||
|
||||
handlers = []
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
self.report({'INFO'}, "ESC or TAB - cancel")
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
|
||||
|
||||
# color change in the panel
|
||||
self.path_color = bpy.context.scene.curvetools.path_color
|
||||
self.path_thickness = bpy.context.scene.curvetools.path_thickness
|
||||
|
||||
def modal(self, context, event):
|
||||
context.area.tag_redraw()
|
||||
|
||||
|
||||
if event.type in {'ESC', 'TAB'}: # Cancel
|
||||
remove_handler(self.handlers)
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
if event.type in {'X', 'DEL'}: # Cancel
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
elif event.alt and event.shift and event.type == 'LEFTMOUSE':
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.alt and not event.shift and event.type == 'LEFTMOUSE':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.alt and event.type == 'RIGHTMOUSE':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
@ -282,12 +282,12 @@ class PathFinder(bpy.types.Operator):
|
|||
|
||||
elif event.alt and not event.shift and event.shift and event.type == 'RIGHTMOUSE':
|
||||
click(self, context, event)
|
||||
|
||||
|
||||
elif event.type == 'A':
|
||||
remove_handler(self.handlers)
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
elif event.type == 'MOUSEMOVE': #
|
||||
|
||||
elif event.type == 'MOUSEMOVE': #
|
||||
self.x = event.mouse_x
|
||||
self.y = event.mouse_y
|
||||
region = bpy.context.region
|
||||
|
@ -297,7 +297,7 @@ class PathFinder(bpy.types.Operator):
|
|||
rv3d,
|
||||
(event.mouse_region_x, event.mouse_region_y),
|
||||
(0.0, 0.0, 0.0)
|
||||
)
|
||||
)
|
||||
|
||||
return {'PASS_THROUGH'}
|
||||
|
||||
|
@ -305,7 +305,7 @@ class PathFinder(bpy.types.Operator):
|
|||
self.execute(context)
|
||||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return util.Selected1OrMoreCurves()
|
||||
|
|
|
@ -12,70 +12,70 @@ bl_info = {
|
|||
}
|
||||
|
||||
def main(context, distance = 0.01):
|
||||
|
||||
|
||||
selected_Curves = util.GetSelectedCurves()
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
|
||||
|
||||
for curve in selected_Curves:
|
||||
bezier_dellist = []
|
||||
dellist = []
|
||||
|
||||
for spline in curve.data.splines:
|
||||
|
||||
for spline in curve.data.splines:
|
||||
if spline.type == 'BEZIER':
|
||||
if len(spline.bezier_points) > 1:
|
||||
for i in range(0, len(spline.bezier_points)):
|
||||
|
||||
for i in range(0, len(spline.bezier_points)):
|
||||
|
||||
if i == 0:
|
||||
ii = len(spline.bezier_points) - 1
|
||||
else:
|
||||
else:
|
||||
ii = i - 1
|
||||
|
||||
|
||||
dot = spline.bezier_points[i];
|
||||
dot1 = spline.bezier_points[ii];
|
||||
|
||||
dot1 = spline.bezier_points[ii];
|
||||
|
||||
while dot1 in bezier_dellist and i != ii:
|
||||
ii -= 1
|
||||
if ii < 0:
|
||||
if ii < 0:
|
||||
ii = len(spline.bezier_points)-1
|
||||
dot1 = spline.bezier_points[ii]
|
||||
|
||||
if dot.select_control_point and dot1.select_control_point and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
|
||||
if dot.select_control_point and dot1.select_control_point and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
if (dot.co-dot1.co).length < distance:
|
||||
# remove points and recreate hangles
|
||||
dot1.handle_right_type = "FREE"
|
||||
dot1.handle_right = dot.handle_right
|
||||
dot1.co = (dot.co + dot1.co) / 2
|
||||
bezier_dellist.append(dot)
|
||||
|
||||
|
||||
else:
|
||||
# Handles that are on main point position converts to vector,
|
||||
# if next handle are also vector
|
||||
if dot.handle_left_type == 'VECTOR' and (dot1.handle_right - dot1.co).length < distance:
|
||||
dot1.handle_right_type = "VECTOR"
|
||||
if dot1.handle_right_type == 'VECTOR' and (dot.handle_left - dot.co).length < distance:
|
||||
dot.handle_left_type = "VECTOR"
|
||||
dot.handle_left_type = "VECTOR"
|
||||
else:
|
||||
if len(spline.points) > 1:
|
||||
for i in range(0, len(spline.points)):
|
||||
|
||||
for i in range(0, len(spline.points)):
|
||||
|
||||
if i == 0:
|
||||
ii = len(spline.points) - 1
|
||||
else:
|
||||
else:
|
||||
ii = i - 1
|
||||
|
||||
|
||||
dot = spline.points[i];
|
||||
dot1 = spline.points[ii];
|
||||
|
||||
dot1 = spline.points[ii];
|
||||
|
||||
while dot1 in dellist and i != ii:
|
||||
ii -= 1
|
||||
if ii < 0:
|
||||
if ii < 0:
|
||||
ii = len(spline.points)-1
|
||||
dot1 = spline.points[ii]
|
||||
|
||||
if dot.select and dot1.select and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
|
||||
if dot.select and dot1.select and (i!=0 or spline.use_cyclic_u):
|
||||
|
||||
if (dot.co-dot1.co).length < distance:
|
||||
dot1.co = (dot.co + dot1.co) / 2
|
||||
dellist.append(dot)
|
||||
|
@ -84,19 +84,19 @@ def main(context, distance = 0.01):
|
|||
|
||||
for dot in bezier_dellist:
|
||||
dot.select_control_point = True
|
||||
|
||||
|
||||
for dot in dellist:
|
||||
dot.select = True
|
||||
|
||||
|
||||
bezier_count = len(bezier_dellist)
|
||||
count = len(dellist)
|
||||
|
||||
|
||||
bpy.ops.curve.delete(type = 'VERT')
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action = 'DESELECT')
|
||||
|
||||
|
||||
return bezier_count + count
|
||||
|
||||
|
||||
|
||||
|
||||
class CurveRemvDbs(bpy.types.Operator):
|
||||
|
|
|
@ -38,41 +38,41 @@ def get_points(spline, matrix_world):
|
|||
|
||||
bezier_points = spline.bezier_points
|
||||
|
||||
if len(bezier_points) < 2:
|
||||
if len(bezier_points) < 2:
|
||||
return []
|
||||
|
||||
r = spline.resolution_u + 1
|
||||
if r < 2:
|
||||
return []
|
||||
segments = len(bezier_points)
|
||||
|
||||
|
||||
if not spline.use_cyclic_u:
|
||||
segments -= 1
|
||||
|
||||
|
||||
point_list = []
|
||||
for i in range(segments):
|
||||
inext = (i + 1) % len(bezier_points)
|
||||
|
||||
|
||||
bezier_points1 = matrix_world @ bezier_points[i].co
|
||||
handle1 = matrix_world @ bezier_points[i].handle_right
|
||||
handle2 = matrix_world @ bezier_points[inext].handle_left
|
||||
bezier_points2 = matrix_world @ bezier_points[inext].co
|
||||
|
||||
|
||||
bezier = bezier_points1, handle1, handle2, bezier_points2, r
|
||||
points = interpolate_bezier(*bezier)
|
||||
point_list.extend(points)
|
||||
|
||||
|
||||
return point_list
|
||||
|
||||
|
||||
def draw(self, context, splines, curve_vertcolor, matrix_world):
|
||||
|
||||
|
||||
for spline in splines:
|
||||
points = get_points(spline, matrix_world)
|
||||
|
||||
|
||||
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
||||
|
||||
batch = batch_for_shader(shader, 'POINTS', {"pos": points})
|
||||
|
||||
|
||||
shader.bind()
|
||||
shader.uniform_float("color", curve_vertcolor)
|
||||
batch.draw(shader)
|
||||
|
@ -82,13 +82,13 @@ class ShowCurveResolution(bpy.types.Operator):
|
|||
bl_idname = "curvetools.show_resolution"
|
||||
bl_label = "Show Curve Resolution"
|
||||
bl_description = "Show curve Resolution / [ESC] - remove"
|
||||
|
||||
|
||||
handlers = []
|
||||
|
||||
|
||||
def modal(self, context, event):
|
||||
context.area.tag_redraw()
|
||||
|
||||
if event.type in {'ESC'}:
|
||||
if event.type in {'ESC'}:
|
||||
for handler in self.handlers:
|
||||
try:
|
||||
bpy.types.SpaceView3D.draw_handler_remove(handler, 'WINDOW')
|
||||
|
@ -104,16 +104,16 @@ class ShowCurveResolution(bpy.types.Operator):
|
|||
def invoke(self, context, event):
|
||||
|
||||
if context.area.type == 'VIEW_3D':
|
||||
|
||||
|
||||
# color change in the panel
|
||||
curve_vertcolor = bpy.context.scene.curvetools.curve_vertcolor
|
||||
|
||||
|
||||
splines = context.active_object.data.splines
|
||||
matrix_world = context.active_object.matrix_world
|
||||
|
||||
|
||||
# the arguments we pass the the callback
|
||||
args = (self, context, splines, curve_vertcolor, matrix_world)
|
||||
|
||||
|
||||
# Add the region OpenGL drawing callback
|
||||
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
||||
self.handlers.append(bpy.types.SpaceView3D.draw_handler_add(draw, args, 'WINDOW', 'POST_VIEW'))
|
||||
|
@ -121,10 +121,10 @@ class ShowCurveResolution(bpy.types.Operator):
|
|||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
else:
|
||||
self.report({'WARNING'},
|
||||
self.report({'WARNING'},
|
||||
"View3D not found, cannot run operator")
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.object is not None and
|
||||
|
|
|
@ -39,7 +39,7 @@ from bpy.props import (
|
|||
def draw_number(n, co, font_height):
|
||||
|
||||
point_list = []
|
||||
|
||||
|
||||
numeral = [
|
||||
[Vector((0, 0, 0)), Vector((0, 2, 0)), Vector((0, 2, 0)), Vector((1, 2, 0)), Vector((1, 2, 0)), Vector((1, 0, 0)), Vector((1, 0, 0)), Vector((0, 0, 0))],
|
||||
[Vector((0, 1, 0)), Vector((1, 2, 0)), Vector((1, 2, 0)), Vector((1, 0, 0))],
|
||||
|
@ -52,20 +52,20 @@ def draw_number(n, co, font_height):
|
|||
[Vector((0, 1, 0)), Vector((0, 2, 0)), Vector((0, 2, 0)), Vector((1, 2, 0)), Vector((1, 2, 0)), Vector((1, 0, 0)), Vector((1, 0, 0)), Vector((0, 0, 0)), Vector((0, 0, 0)), Vector((0, 1, 0)), Vector((0, 1, 0)), Vector((1, 1, 0))],
|
||||
[Vector((0, 0, 0)), Vector((1, 1, 0)), Vector((1, 1, 0)), Vector((1, 2, 0)), Vector((1, 2, 0)), Vector((0, 2, 0)), Vector((0, 2, 0)), Vector((0, 1, 0)), Vector((0, 1, 0)), Vector((1, 1, 0))],
|
||||
]
|
||||
|
||||
|
||||
for num in numeral[n]:
|
||||
point_list.extend([num * font_height + co])
|
||||
|
||||
|
||||
return point_list
|
||||
|
||||
|
||||
|
||||
def draw(self, context, splines, sequence_color, font_thickness, font_size, matrix_world):
|
||||
|
||||
splines_len = len(splines)
|
||||
for n in range(0, splines_len):
|
||||
|
||||
|
||||
res = [int(x) for x in str(n)]
|
||||
|
||||
|
||||
i = 0
|
||||
for r in res:
|
||||
# draw some text
|
||||
|
@ -74,14 +74,14 @@ def draw(self, context, splines, sequence_color, font_thickness, font_size, matr
|
|||
else:
|
||||
first_point = matrix_world @ splines[n].points[0].co
|
||||
first_point_co = Vector((first_point.x, first_point.y, first_point.z))
|
||||
|
||||
|
||||
first_point_co = Vector((i, 0, 0)) + first_point_co
|
||||
points = draw_number(r, first_point_co, font_size)
|
||||
|
||||
|
||||
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
|
||||
|
||||
batch = batch_for_shader(shader, 'LINES', {"pos": points})
|
||||
|
||||
|
||||
shader.bind()
|
||||
bgl.glLineWidth(font_thickness)
|
||||
shader.uniform_float("color", sequence_color)
|
||||
|
@ -92,13 +92,13 @@ class ShowSplinesSequence(bpy.types.Operator):
|
|||
bl_idname = "curvetools.show_splines_sequence"
|
||||
bl_label = "Show Splines Sequence"
|
||||
bl_description = "Show Splines Sequence / [ESC] - remove"
|
||||
|
||||
|
||||
handlers = []
|
||||
|
||||
|
||||
def modal(self, context, event):
|
||||
context.area.tag_redraw()
|
||||
|
||||
if event.type in {'ESC'}:
|
||||
if event.type in {'ESC'}:
|
||||
for handler in self.handlers:
|
||||
try:
|
||||
bpy.types.SpaceView3D.draw_handler_remove(handler, 'WINDOW')
|
||||
|
@ -114,18 +114,18 @@ class ShowSplinesSequence(bpy.types.Operator):
|
|||
def invoke(self, context, event):
|
||||
|
||||
if context.area.type == 'VIEW_3D':
|
||||
|
||||
|
||||
# color change in the panel
|
||||
sequence_color = bpy.context.scene.curvetools.sequence_color
|
||||
font_thickness = bpy.context.scene.curvetools.font_thickness
|
||||
font_size = bpy.context.scene.curvetools.font_size
|
||||
|
||||
|
||||
splines = context.active_object.data.splines
|
||||
matrix_world = context.active_object.matrix_world
|
||||
|
||||
|
||||
# the arguments we pass the the callback
|
||||
args = (self, context, splines, sequence_color, font_thickness, font_size, matrix_world)
|
||||
|
||||
|
||||
# Add the region OpenGL drawing callback
|
||||
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'
|
||||
self.handlers.append(bpy.types.SpaceView3D.draw_handler_add(draw, args, 'WINDOW', 'POST_VIEW'))
|
||||
|
@ -133,7 +133,7 @@ class ShowSplinesSequence(bpy.types.Operator):
|
|||
context.window_manager.modal_handler_add(self)
|
||||
return {'RUNNING_MODAL'}
|
||||
else:
|
||||
self.report({'WARNING'},
|
||||
self.report({'WARNING'},
|
||||
"View3D not found, cannot run operator")
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
@ -149,17 +149,17 @@ def rearrangesplines(dataCurve, select_spline1, select_spline2):
|
|||
|
||||
spline1 = dataCurve.splines[select_spline1]
|
||||
spline2 = dataCurve.splines[select_spline2]
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action='SELECT')
|
||||
bpy.ops.curve.spline_type_set(type='BEZIER')
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
type1 = spline1.type
|
||||
type2 = spline2.type
|
||||
|
||||
|
||||
len_spline1 = len(spline1.bezier_points)
|
||||
len_spline2 = len(spline2.bezier_points)
|
||||
|
||||
|
||||
newSpline = dataCurve.splines.new(type=type1)
|
||||
newSpline.bezier_points.add(len_spline1 - 1)
|
||||
newSpline.use_cyclic_u = spline1.use_cyclic_u
|
||||
|
@ -170,7 +170,7 @@ def rearrangesplines(dataCurve, select_spline1, select_spline2):
|
|||
newSpline.bezier_points[n].handle_right_type = spline1.bezier_points[n].handle_right_type
|
||||
newSpline.bezier_points[n].handle_right = spline1.bezier_points[n].handle_right
|
||||
spline1.bezier_points[n].select_control_point = True
|
||||
|
||||
|
||||
spline1.bezier_points[0].select_control_point = False
|
||||
spline1.bezier_points[0].select_left_handle = False
|
||||
spline1.bezier_points[0].select_right_handle = False
|
||||
|
@ -178,7 +178,7 @@ def rearrangesplines(dataCurve, select_spline1, select_spline2):
|
|||
|
||||
spline1.bezier_points[0].select_control_point = True
|
||||
bpy.ops.curve.spline_type_set(type=type2)
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
|
||||
spline1.bezier_points.add(len_spline2 - 1)
|
||||
|
@ -193,12 +193,12 @@ def rearrangesplines(dataCurve, select_spline1, select_spline2):
|
|||
spline1.bezier_points[n].select_left_handle = False
|
||||
spline1.bezier_points[n].select_right_handle = False
|
||||
spline2.bezier_points[n].select_control_point = True
|
||||
|
||||
|
||||
spline2.bezier_points[0].select_control_point = False
|
||||
spline2.bezier_points[0].select_left_handle = False
|
||||
spline2.bezier_points[0].select_right_handle = False
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
|
||||
|
||||
spline2.bezier_points[0].select_control_point = True
|
||||
bpy.ops.curve.spline_type_set(type=type1)
|
||||
|
||||
|
@ -210,29 +210,29 @@ def rearrangesplines(dataCurve, select_spline1, select_spline2):
|
|||
spline2.bezier_points[m].handle_left = newSpline.bezier_points[m].handle_left
|
||||
spline2.bezier_points[m].handle_right_type = newSpline.bezier_points[m].handle_right_type
|
||||
spline2.bezier_points[m].handle_right = newSpline.bezier_points[m].handle_right
|
||||
|
||||
|
||||
bpy.ops.curve.select_all(action='DESELECT')
|
||||
for point in newSpline.bezier_points:
|
||||
point.select_control_point = True
|
||||
bpy.ops.curve.delete(type='VERT')
|
||||
|
||||
spline2.bezier_points[0].select_control_point = True
|
||||
|
||||
|
||||
def rearrange(dataCurve, select_spline, command):
|
||||
len_splines = len(dataCurve.splines)
|
||||
if command == 'NEXT':
|
||||
if select_spline < len_splines - 1:
|
||||
rearrangesplines(dataCurve, select_spline + 1, select_spline)
|
||||
|
||||
|
||||
if command == 'PREV':
|
||||
if select_spline > 0:
|
||||
rearrangesplines(dataCurve, select_spline, select_spline - 1)
|
||||
|
||||
|
||||
class RearrangeSpline(bpy.types.Operator):
|
||||
bl_idname = "curvetools.rearrange_spline"
|
||||
bl_label = "Rearrange Spline"
|
||||
bl_description = "Rearrange Spline"
|
||||
|
||||
|
||||
Types = [('NEXT', "Next", "next"),
|
||||
('PREV', "Prev", "prev")]
|
||||
command : EnumProperty(
|
||||
|
@ -240,17 +240,17 @@ class RearrangeSpline(bpy.types.Operator):
|
|||
description="Command (prev or next)",
|
||||
items=Types
|
||||
)
|
||||
|
||||
|
||||
def execute(self, context):
|
||||
bpy.ops.object.mode_set(mode = 'EDIT')
|
||||
bpy.context.view_layer.update()
|
||||
|
||||
|
||||
dataCurve = context.active_object.data
|
||||
|
||||
|
||||
splines = context.active_object.data.splines
|
||||
|
||||
|
||||
select_spline = 0
|
||||
|
||||
|
||||
sn = 0
|
||||
for spline in splines:
|
||||
for bezier_points in spline.bezier_points:
|
||||
|
@ -264,9 +264,9 @@ class RearrangeSpline(bpy.types.Operator):
|
|||
if point.select:
|
||||
select_spline = sn
|
||||
sn += 1
|
||||
|
||||
|
||||
rearrange(dataCurve, select_spline, self.command)
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -12,8 +12,8 @@ def GetSelectedCurves():
|
|||
pass
|
||||
|
||||
return rvList
|
||||
|
||||
|
||||
|
||||
|
||||
def GetSelectedMeshes():
|
||||
rvList = []
|
||||
|
||||
|
@ -84,7 +84,7 @@ def Selected1OrMoreCurves():
|
|||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def Selected2OrMoreCurves():
|
||||
try:
|
||||
if len(GetSelectedCurves()) > 1:
|
||||
|
|
|
@ -40,7 +40,7 @@ from bpy.types import (
|
|||
Menu,
|
||||
PropertyGroup
|
||||
)
|
||||
from bpy.props import (
|
||||
from bpy.props import (
|
||||
EnumProperty,
|
||||
StringProperty,
|
||||
IntProperty
|
||||
|
@ -55,7 +55,7 @@ def stdlib_excludes():
|
|||
for nm in files:
|
||||
if nm != '__init__.py' and nm[-3:] == '.py':
|
||||
excludes.append(os.path.join(top, nm)[len(std_lib)+1:-3].replace('\\','.'))
|
||||
|
||||
|
||||
return excludes
|
||||
|
||||
def make_loc(prefix, c):
|
||||
|
@ -63,19 +63,19 @@ def make_loc(prefix, c):
|
|||
space = ""
|
||||
#if hasattr(c, "bl_space_type"):
|
||||
# space = c.bl_space_type
|
||||
|
||||
|
||||
region = ""
|
||||
#if hasattr(c, "bl_region_type"):
|
||||
# region = c.bl_region_type
|
||||
|
||||
|
||||
label = ""
|
||||
if hasattr(c, "bl_label"):
|
||||
label = c.bl_label
|
||||
|
||||
|
||||
return prefix+": " + space + " " + region + " " + label
|
||||
|
||||
def walk_module(opname, mod, calls=[], exclude=[]):
|
||||
|
||||
|
||||
for name, m in inspect.getmembers(mod):
|
||||
if inspect.ismodule(m):
|
||||
if m.__name__ not in exclude:
|
||||
|
@ -94,7 +94,7 @@ def walk_module(opname, mod, calls=[], exclude=[]):
|
|||
if opname in s:
|
||||
file = mod.__file__
|
||||
line = n + i
|
||||
|
||||
|
||||
if issubclass(m, Panel) and name != "Panel":
|
||||
loc = make_loc("Panel", m)
|
||||
calls.append([opname, loc, file, line])
|
||||
|
@ -121,10 +121,10 @@ def getclazz(opname):
|
|||
def getmodule(opname):
|
||||
addon = True
|
||||
clazz = getclazz(opname)
|
||||
|
||||
|
||||
if clazz is None:
|
||||
return "", -1, False
|
||||
|
||||
|
||||
modn = clazz.__module__
|
||||
|
||||
try:
|
||||
|
@ -168,24 +168,24 @@ def get_ops():
|
|||
return [(y, y, "", x) for x, y in enumerate(l)]
|
||||
|
||||
class OperatorEntry(PropertyGroup):
|
||||
|
||||
|
||||
label : StringProperty(
|
||||
name="Label",
|
||||
description="",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
path : StringProperty(
|
||||
name="Path",
|
||||
description="",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
line : IntProperty(
|
||||
name="Line",
|
||||
description="",
|
||||
default=-1
|
||||
)
|
||||
)
|
||||
|
||||
class TEXT_OT_EditOperator(Operator):
|
||||
bl_idname = "text.edit_operator"
|
||||
|
@ -200,22 +200,22 @@ class TEXT_OT_EditOperator(Operator):
|
|||
description="",
|
||||
items=items
|
||||
)
|
||||
|
||||
|
||||
path : StringProperty(
|
||||
name="Path",
|
||||
description="",
|
||||
default=""
|
||||
)
|
||||
|
||||
|
||||
line : IntProperty(
|
||||
name="Line",
|
||||
description="",
|
||||
default=-1
|
||||
)
|
||||
|
||||
|
||||
def show_text(self, context, path, line):
|
||||
found = False
|
||||
|
||||
|
||||
for t in bpy.data.texts:
|
||||
if t.filepath == path:
|
||||
#switch to the wanted text first
|
||||
|
@ -231,25 +231,25 @@ class TEXT_OT_EditOperator(Operator):
|
|||
"Opened file: " + path)
|
||||
bpy.ops.text.open(filepath=path)
|
||||
bpy.ops.text.jump(line=line)
|
||||
|
||||
|
||||
def show_calls(self, context):
|
||||
import bl_ui
|
||||
import addon_utils
|
||||
|
||||
|
||||
exclude = stdlib_excludes()
|
||||
exclude.append("bpy")
|
||||
exclude.append("sys")
|
||||
|
||||
|
||||
calls = []
|
||||
walk_module(self.op, bl_ui, calls, exclude)
|
||||
|
||||
|
||||
for m in addon_utils.modules():
|
||||
try:
|
||||
mod = sys.modules[m.__name__]
|
||||
walk_module(self.op, mod, calls, exclude)
|
||||
except KeyError:
|
||||
continue
|
||||
|
||||
|
||||
for c in calls:
|
||||
cl = context.scene.calls.add()
|
||||
cl.name = c[0]
|
||||
|
@ -265,33 +265,33 @@ class TEXT_OT_EditOperator(Operator):
|
|||
if self.path != "" and self.line != -1:
|
||||
#invocation of one of the "found" locations
|
||||
self.show_text(context, self.path, self.line)
|
||||
return {'FINISHED'}
|
||||
return {'FINISHED'}
|
||||
else:
|
||||
context.scene.calls.clear()
|
||||
path, line, addon = getmodule(self.op)
|
||||
|
||||
|
||||
if addon:
|
||||
self.show_text(context, path, line)
|
||||
|
||||
|
||||
#add convenient "source" button, to toggle back from calls to source
|
||||
c = context.scene.calls.add()
|
||||
c.name = self.op
|
||||
c.label = "Source"
|
||||
c.path = path
|
||||
c.line = line
|
||||
|
||||
|
||||
self.show_calls(context)
|
||||
context.area.tag_redraw()
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
else:
|
||||
|
||||
|
||||
self.report({'WARNING'},
|
||||
"Found no source file for " + self.op)
|
||||
|
||||
|
||||
self.show_calls(context)
|
||||
context.area.tag_redraw()
|
||||
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
@ -307,7 +307,7 @@ class TEXT_PT_EditOperatorPanel(Panel):
|
|||
op = layout.operator("text.edit_operator")
|
||||
op.path = ""
|
||||
op.line = -1
|
||||
|
||||
|
||||
if len(context.scene.calls) > 0:
|
||||
box = layout.box()
|
||||
box.label(text="Calls of: " + context.scene.calls[0].name)
|
||||
|
@ -321,7 +321,7 @@ class TEXT_PT_EditOperatorPanel(Panel):
|
|||
|
||||
def register():
|
||||
bpy.utils.register_class(OperatorEntry)
|
||||
bpy.types.Scene.calls = bpy.props.CollectionProperty(name="Calls",
|
||||
bpy.types.Scene.calls = bpy.props.CollectionProperty(name="Calls",
|
||||
type=OperatorEntry)
|
||||
bpy.utils.register_class(TEXT_OT_EditOperator)
|
||||
bpy.utils.register_class(TEXT_PT_EditOperatorPanel)
|
||||
|
|
|
@ -850,10 +850,10 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
if(scene_objects.coat3D.applink_address == new_applink_address):
|
||||
new_object = False
|
||||
|
||||
|
||||
|
||||
elif(os.path.isfile(exportfile3)):
|
||||
obj_pathh = open(exportfile3)
|
||||
|
||||
|
||||
for line in obj_pathh:
|
||||
new_applink_address = line
|
||||
break
|
||||
|
@ -865,7 +865,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
scene_objects.coat3D.type == ''
|
||||
new_ref_object = True
|
||||
nimi = scene_objects.name
|
||||
|
||||
|
||||
|
||||
|
||||
exportfile = coat3D.exchangedir
|
||||
|
@ -873,7 +873,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
exportfile += ('%sexport.txt' % (os.sep))
|
||||
if (os.path.isfile(exportfile)):
|
||||
os.remove(exportfile)
|
||||
|
||||
|
||||
if(new_ref_object):
|
||||
|
||||
create_collection = True
|
||||
|
@ -899,7 +899,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
old_objects = bpy.data.objects.keys()
|
||||
object_list = []
|
||||
|
||||
|
||||
|
||||
bpy.ops.import_scene.fbx(filepath=new_applink_address, global_scale = 0.01,axis_forward='X', axis_up='Y',use_custom_normals=False)
|
||||
new_objects = bpy.data.objects.keys()
|
||||
diff_objects = [i for i in new_objects if i not in old_objects]
|
||||
|
@ -909,12 +909,12 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
|
||||
refmesh = bpy.data.objects[nimi]
|
||||
copymesh = bpy.data.objects[nimi].copy()
|
||||
|
||||
|
||||
copymesh.data = bpy.data.objects[diff_object].data
|
||||
copymesh.coat3D.applink_name = bpy.data.objects[diff_object].data.name
|
||||
copymesh.coat3D.applink_address = refmesh.coat3D.applink_address
|
||||
ne_name = bpy.data.objects[diff_object].data.name
|
||||
|
||||
|
||||
copymesh.coat3D.type = 'ppp'
|
||||
copymesh.coat3D.retopo = True
|
||||
|
||||
|
@ -931,7 +931,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
copymesh.material_slots[0].material.node_tree.nodes['Principled BSDF'].inputs['Metallic'].default_value = 0
|
||||
copymesh.material_slots[0].material.node_tree.nodes['Principled BSDF'].inputs['Specular'].default_value = 0.5
|
||||
|
||||
|
||||
|
||||
refmesh.coat3D.applink_name = ''
|
||||
refmesh.coat3D.applink_address = ''
|
||||
refmesh.coat3D.type = ''
|
||||
|
@ -998,7 +998,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
path3b_n = coat3D.exchangedir
|
||||
path3b_n += ('%slast_saved_3b_file.txt' % (os.sep))
|
||||
if(objekti.coat3D.import_mesh and coat3D.importmesh == True):
|
||||
|
||||
|
||||
objekti.coat3D.import_mesh = False
|
||||
objekti.select_set(True)
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
|
||||
'''Changes objects mesh into proxy mesh'''
|
||||
if(objekti.coat3D.type != 'ref'):
|
||||
|
||||
|
||||
for proxy_objects in diff_objects:
|
||||
if(objekti.coat3D.retopo == False):
|
||||
if (proxy_objects == objekti.coat3D.applink_name):
|
||||
|
@ -1151,7 +1151,7 @@ class SCENE_OT_import(bpy.types.Operator):
|
|||
objekti.coat3D.applink_name = objekti.name
|
||||
objekti.coat3D.applink_mesh = True
|
||||
objekti.coat3D.import_mesh = False
|
||||
|
||||
|
||||
bpy.ops.object.transforms_to_deltas(mode='SCALE')
|
||||
objekti.coat3D.applink_firsttime = False
|
||||
bpy.context.collection.all_objects[del_obj].select_set(False)
|
||||
|
|
|
@ -565,12 +565,12 @@ def CreateTextureLine(type, act_material, main_mat, texcoat, coat3D, notegroup,
|
|||
|
||||
tile_int_x = int(tile[3])
|
||||
tile_int_y = int(tile[2])
|
||||
|
||||
|
||||
min_node = texture_tree.nodes.new('ShaderNodeVectorMath')
|
||||
min_node.operation = "MINIMUM"
|
||||
min_node.inputs[1].default_value[0] = tile_int_x - 1
|
||||
min_node.inputs[1].default_value[1] = tile_int_y
|
||||
|
||||
|
||||
max_node = texture_tree.nodes.new('ShaderNodeVectorMath')
|
||||
max_node.operation = "MAXIMUM"
|
||||
max_node.inputs[1].default_value[0] = tile_int_x
|
||||
|
|
|
@ -1741,30 +1741,30 @@ class SVGGeometrySVG(SVGGeometryContainer):
|
|||
matrix = self.getNodeMatrix()
|
||||
|
||||
# Better SVG compatibility: match svg-document units
|
||||
# with blender units
|
||||
|
||||
# with blender units
|
||||
|
||||
viewbox = []
|
||||
unit = ''
|
||||
|
||||
|
||||
if self._node.getAttribute('height'):
|
||||
raw_height = self._node.getAttribute('height')
|
||||
token, last_char = read_float(raw_height)
|
||||
document_height = float(token)
|
||||
unit = raw_height[last_char:].strip()
|
||||
|
||||
unit = raw_height[last_char:].strip()
|
||||
|
||||
if self._node.getAttribute('viewBox'):
|
||||
viewbox = parse_array_of_floats(self._node.getAttribute('viewBox'))
|
||||
|
||||
|
||||
if len(viewbox) == 4 and unit in ('cm', 'mm', 'in', 'pt', 'pc'):
|
||||
|
||||
#convert units to BU:
|
||||
unitscale = units[unit] / 90 * 1000 / 39.3701
|
||||
|
||||
#apply blender unit scale:
|
||||
#convert units to BU:
|
||||
unitscale = units[unit] / 90 * 1000 / 39.3701
|
||||
|
||||
#apply blender unit scale:
|
||||
unitscale = unitscale / bpy.context.scene.unit_settings.scale_length
|
||||
|
||||
|
||||
matrix = matrix @ Matrix.Scale(unitscale, 4, Vector((1.0, 0.0, 0.0)))
|
||||
matrix = matrix @ Matrix.Scale(unitscale, 4, Vector((0.0, 1.0, 0.0)))
|
||||
matrix = matrix @ Matrix.Scale(unitscale, 4, Vector((0.0, 1.0, 0.0)))
|
||||
|
||||
# match document origin with 3D space origin.
|
||||
if self._node.getAttribute('viewBox'):
|
||||
|
|
|
@ -56,6 +56,6 @@ def unregister():
|
|||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
bpy.types.TOPBAR_MT_file_export.remove(menu_func)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
register()
|
||||
|
|
|
@ -41,7 +41,7 @@ def exportDXF(context, filePath, settings):
|
|||
print("Generating Object list for export... (Root parents only)")
|
||||
|
||||
scene = context.scene
|
||||
|
||||
|
||||
if settings['onlySelected'] is True:
|
||||
objects = (ob for ob in scene.objects if not ob.hide_viewport and ob.select_get() and ob.type in SUPPORTED_TYPES)
|
||||
else:
|
||||
|
|
|
@ -69,7 +69,7 @@ class MeshDXFExporter(BasePrimitiveDXFExporter):
|
|||
allpoints = self.toGlobalOrigin(allpoints)
|
||||
faces=[]
|
||||
edges=[]
|
||||
|
||||
|
||||
me.calc_loop_triangles() #me.update(calc_tessface=True)
|
||||
me_faces = me.loop_triangles #tessfaces
|
||||
#print('deb: allpoints=\n', allpoints) #---------
|
||||
|
|
|
@ -185,7 +185,7 @@ class Unfolder:
|
|||
bm = bmesh.from_edit_mesh(ob.data)
|
||||
self.mesh = Mesh(bm, ob.matrix_world)
|
||||
self.mesh.check_correct()
|
||||
|
||||
|
||||
def __del__(self):
|
||||
if not self.do_create_uvmap:
|
||||
self.mesh.delete_uvmap()
|
||||
|
@ -264,7 +264,7 @@ class Unfolder:
|
|||
bk.use_pass_direct, bk.use_pass_indirect, bk.use_pass_color = False, False, True
|
||||
sce.cycles.samples = 1
|
||||
else:
|
||||
sce.cycles.samples = properties.bake_samples
|
||||
sce.cycles.samples = properties.bake_samples
|
||||
if sce.cycles.bake_type == 'COMBINED':
|
||||
bk.use_pass_direct, bk.use_pass_indirect = True, True
|
||||
bk.use_pass_diffuse, bk.use_pass_glossy, bk.use_pass_transmission, bk.use_pass_subsurface, bk.use_pass_ambient_occlusion, bk.use_pass_emit = True, False, False, True, True, True
|
||||
|
@ -302,10 +302,10 @@ class Mesh:
|
|||
if edge.main_faces:
|
||||
edge.calculate_angle()
|
||||
self.copy_freestyle_marks()
|
||||
|
||||
|
||||
def delete_uvmap(self):
|
||||
self.data.loops.layers.uv.remove(self.looptex) if self.looptex else None
|
||||
|
||||
|
||||
def copy_freestyle_marks(self):
|
||||
# NOTE: this is a workaround for NotImplementedError on bmesh.edges.layers.freestyle
|
||||
mesh = bpy.data.meshes.new("unfolder_temp")
|
||||
|
@ -313,7 +313,7 @@ class Mesh:
|
|||
for bmedge, edge in self.edges.items():
|
||||
edge.freestyle = mesh.edges[bmedge.index].use_freestyle_mark
|
||||
bpy.data.meshes.remove(mesh)
|
||||
|
||||
|
||||
def mark_cuts(self):
|
||||
for bmedge, edge in self.edges.items():
|
||||
if edge.is_main_cut and not bmedge.is_boundary:
|
||||
|
@ -329,7 +329,7 @@ class Mesh:
|
|||
diameter = max((center - vertex.co).length for vertex in face.verts)
|
||||
threshold = 0.01 * diameter
|
||||
return any(abs(v.co.dot(face.normal) - plane_d) > threshold for v in face.verts)
|
||||
|
||||
|
||||
null_edges = {e for e in self.edges.keys() if e.calc_length() < epsilon and e.link_faces}
|
||||
null_faces = {f for f in self.data.faces if f.calc_area() < epsilon}
|
||||
twisted_faces = {f for f in self.data.faces if is_twisted(f)}
|
||||
|
@ -452,7 +452,7 @@ class Mesh:
|
|||
def add_sticker(uvedge, index, target_uvedge):
|
||||
uvedge.sticker = Sticker(uvedge, default_width, index, target_uvedge)
|
||||
uvedge.uvface.island.add_marker(uvedge.sticker)
|
||||
|
||||
|
||||
def is_index_obvious(uvedge, target):
|
||||
if uvedge in (target.neighbor_left, target.neighbor_right):
|
||||
return True
|
||||
|
@ -632,7 +632,7 @@ class Mesh:
|
|||
island.image_path = image_path
|
||||
image.user_clear()
|
||||
bpy.data.images.remove(image)
|
||||
|
||||
|
||||
def bake(self, faces, image):
|
||||
if not self.looptex:
|
||||
raise UnfoldError("The mesh has no UV Map slots left. Either delete a UV Map or export the net without textures.")
|
||||
|
@ -766,14 +766,14 @@ class Island:
|
|||
self.is_inside_out = False # swaps concave <-> convex edges
|
||||
self.has_safe_geometry = True
|
||||
self.sticker_numbering = 0
|
||||
|
||||
|
||||
uvface = UVFace(face, self, matrix, normal_matrix)
|
||||
self.vertices.update(uvface.vertices)
|
||||
self.edges.update(uvface.edges)
|
||||
self.faces[face] = uvface
|
||||
# UVEdges on the boundary
|
||||
self.boundary = list(self.edges.values())
|
||||
|
||||
|
||||
def add_marker(self, marker):
|
||||
self.fake_vertices.extend(marker.bounds)
|
||||
self.markers.append(marker)
|
||||
|
@ -2050,7 +2050,7 @@ class ExportPaperModel(bpy.types.Operator):
|
|||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.active_object and context.active_object.type == 'MESH'
|
||||
|
||||
|
||||
def prepare(self, context):
|
||||
sce = context.scene
|
||||
self.recall_mode = context.object.mode
|
||||
|
@ -2062,7 +2062,7 @@ class ExportPaperModel(bpy.types.Operator):
|
|||
self.unfolder.prepare(cage_size, scale=sce.unit_settings.scale_length/self.scale, limit_by_page=sce.paper_model.limit_by_page)
|
||||
if self.scale == 1:
|
||||
self.scale = ceil(self.get_scale_ratio(sce))
|
||||
|
||||
|
||||
def recall(self):
|
||||
if self.unfolder:
|
||||
del self.unfolder
|
||||
|
@ -2225,7 +2225,7 @@ class SelectIsland(bpy.types.Operator):
|
|||
bl_idname = "mesh.select_paper_island"
|
||||
bl_label = "Select Island"
|
||||
bl_description = "Select an island of the paper model net"
|
||||
|
||||
|
||||
operation: bpy.props.EnumProperty(
|
||||
name="Operation", description="Operation with the current selection",
|
||||
default='ADD', items=[
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
# Acknowledgements
|
||||
# ================
|
||||
#
|
||||
# A big thank you to all those people who I met in particular in the IRC and
|
||||
# A big thank you to all those people who I met in particular in the IRC and
|
||||
# who helped me a lot.
|
||||
#
|
||||
# Blender developers
|
||||
# ------------------
|
||||
# Campbell Barton (ideasman)
|
||||
# Brendon Murphy (meta_androcto)
|
||||
# Campbell Barton (ideasman)
|
||||
# Brendon Murphy (meta_androcto)
|
||||
# Truman Melton (?) (truman)
|
||||
# Kilon Alios (kilon)
|
||||
# ?? (CoDEmanX)
|
||||
|
@ -104,7 +104,7 @@ class AddonPreferences(AddonPreferences):
|
|||
default=True,
|
||||
description="Import/export XYZ",
|
||||
)
|
||||
# This boolean is checked in the poll function in PANEL_PT_prepare
|
||||
# This boolean is checked in the poll function in PANEL_PT_prepare
|
||||
# (see utility.py).
|
||||
bool_utility : BoolProperty(
|
||||
name="Utility panel",
|
||||
|
@ -119,7 +119,7 @@ class AddonPreferences(AddonPreferences):
|
|||
layout.prop(self, "bool_pdb")
|
||||
layout.prop(self, "bool_xyz")
|
||||
layout.prop(self, "bool_utility")
|
||||
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Menu
|
||||
|
@ -149,7 +149,7 @@ def menu_func_export_xyz(self, context):
|
|||
|
||||
def register():
|
||||
from bpy.utils import register_class
|
||||
|
||||
|
||||
register_class(AddonPreferences)
|
||||
|
||||
register_class(pdb_gui.IMPORT_OT_pdb)
|
||||
|
@ -162,21 +162,21 @@ def register():
|
|||
bpy.types.TOPBAR_MT_file_import.append(menu_func_import_xyz)
|
||||
bpy.types.TOPBAR_MT_file_export.append(menu_func_export_xyz)
|
||||
|
||||
classes = (utility_gui.PANEL_PT_prepare,
|
||||
classes = (utility_gui.PANEL_PT_prepare,
|
||||
utility_gui.PanelProperties,
|
||||
utility_gui.DatafileApply,
|
||||
utility_gui.DefaultAtom,
|
||||
utility_gui.ReplaceAtom,
|
||||
utility_gui.SeparateAtom,
|
||||
utility_gui.DistanceButton,
|
||||
utility_gui.RadiusAllBiggerButton,
|
||||
utility_gui.RadiusAllSmallerButton,
|
||||
utility_gui.SticksAllBiggerButton,
|
||||
utility_gui.DatafileApply,
|
||||
utility_gui.DefaultAtom,
|
||||
utility_gui.ReplaceAtom,
|
||||
utility_gui.SeparateAtom,
|
||||
utility_gui.DistanceButton,
|
||||
utility_gui.RadiusAllBiggerButton,
|
||||
utility_gui.RadiusAllSmallerButton,
|
||||
utility_gui.SticksAllBiggerButton,
|
||||
utility_gui.SticksAllSmallerButton)
|
||||
from bpy.utils import register_class
|
||||
utility_panel.read_elements()
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
register_class(cls)
|
||||
|
||||
scene = bpy.types.Scene
|
||||
scene.atom_blend = bpy.props.PointerProperty(type=utility_gui.PanelProperties)
|
||||
|
@ -197,19 +197,19 @@ def unregister():
|
|||
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import_xyz)
|
||||
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export_xyz)
|
||||
|
||||
classes = (utility_gui.PANEL_PT_prepare,
|
||||
classes = (utility_gui.PANEL_PT_prepare,
|
||||
utility_gui.PanelProperties,
|
||||
utility_gui.DatafileApply,
|
||||
utility_gui.DefaultAtom,
|
||||
utility_gui.ReplaceAtom,
|
||||
utility_gui.SeparateAtom,
|
||||
utility_gui.DistanceButton,
|
||||
utility_gui.RadiusAllBiggerButton,
|
||||
utility_gui.RadiusAllSmallerButton,
|
||||
utility_gui.SticksAllBiggerButton,
|
||||
utility_gui.DatafileApply,
|
||||
utility_gui.DefaultAtom,
|
||||
utility_gui.ReplaceAtom,
|
||||
utility_gui.SeparateAtom,
|
||||
utility_gui.DistanceButton,
|
||||
utility_gui.RadiusAllBiggerButton,
|
||||
utility_gui.RadiusAllSmallerButton,
|
||||
utility_gui.SticksAllBiggerButton,
|
||||
utility_gui.SticksAllSmallerButton)
|
||||
for cls in classes:
|
||||
unregister_class(cls)
|
||||
unregister_class(cls)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
|
@ -22,7 +22,7 @@ from bpy.props import (StringProperty,
|
|||
EnumProperty,
|
||||
FloatProperty,
|
||||
BoolProperty)
|
||||
|
||||
|
||||
from io_mesh_atomic.utility_panel import choose_objects
|
||||
from io_mesh_atomic.utility_panel import custom_datafile
|
||||
from io_mesh_atomic.utility_panel import custom_datafile_change_atom_props
|
||||
|
@ -43,7 +43,7 @@ class PANEL_PT_prepare(Panel):
|
|||
bl_idname = "ATOMIC_PT_utilities"
|
||||
|
||||
|
||||
# This thing here just guarantees that the panel is NOT opened when the
|
||||
# This thing here just guarantees that the panel is NOT opened when the
|
||||
# check box in the addon preferences is not activated! See __init__.py
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
|
@ -66,7 +66,7 @@ class PANEL_PT_prepare(Panel):
|
|||
col.operator("atom_blend.button_distance")
|
||||
col.prop(scn, "distance")
|
||||
|
||||
# This is from Blender 2.79 and does not work in 2.80. However, it
|
||||
# This is from Blender 2.79 and does not work in 2.80. However, it
|
||||
# might be useful later on if changed.
|
||||
#
|
||||
#box = layout.box()
|
||||
|
|
|
@ -103,7 +103,7 @@ def __gather_base_color_texture(blender_material, export_settings):
|
|||
inputs = (base_color_socket, alpha_socket, )
|
||||
else:
|
||||
inputs = (base_color_socket,)
|
||||
|
||||
|
||||
return gltf2_blender_gather_texture_info.gather_texture_info(inputs, export_settings)
|
||||
|
||||
|
||||
|
|
|
@ -116,11 +116,11 @@ def _get_transparency_shader():
|
|||
vertex_shader = '''
|
||||
uniform mat4 modelViewMatrix;
|
||||
uniform mat4 projectionMatrix;
|
||||
|
||||
|
||||
in vec2 pos;
|
||||
in vec2 texCoord;
|
||||
out vec2 uvInterp;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
uvInterp = texCoord;
|
||||
|
@ -132,10 +132,10 @@ def _get_transparency_shader():
|
|||
fragment_shader = '''
|
||||
uniform sampler2D image;
|
||||
uniform vec4 color;
|
||||
|
||||
|
||||
in vec2 uvInterp;
|
||||
out vec4 fragColor;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(image, uvInterp);
|
||||
|
|
|
@ -164,7 +164,7 @@ class AutoMirror(bpy.types.Operator):
|
|||
use_fill= False,
|
||||
clear_inner= bpy.context.scene.AutoMirror_cut,
|
||||
clear_outer= 0,
|
||||
threshold= bpy.context.scene.AutoMirror_threshold)
|
||||
threshold= bpy.context.scene.AutoMirror_threshold)
|
||||
|
||||
bpy.ops.object.align_vertices() # Use to align the vertices on the origin, needed by the "threshold"
|
||||
|
||||
|
@ -299,7 +299,7 @@ class AutoMirrorAddonPreferences(AddonPreferences):
|
|||
col = row.column()
|
||||
col.label(text="Tab Category:")
|
||||
col.prop(self, "category", text="")
|
||||
|
||||
|
||||
# define classes for registration
|
||||
classes = (
|
||||
VIEW3D_PT_BisectMirror,
|
||||
|
|
|
@ -317,7 +317,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||
)
|
||||
strokes_type: StringProperty()
|
||||
initial_global_undo_state: BoolProperty()
|
||||
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -3089,14 +3089,14 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
try:
|
||||
global global_in_front
|
||||
self.main_object.show_in_front = global_in_front
|
||||
bpy.context.scene.bsurfaces.SURFSK_in_front = global_in_front
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
try:
|
||||
global global_show_wire
|
||||
self.main_object.show_wire = global_show_wire
|
||||
bpy.context.scene.bsurfaces.SURFSK_show_wire = global_show_wire
|
||||
|
@ -3188,7 +3188,7 @@ class MESH_OT_SURFSK_add_surface(Operator):
|
|||
if global_shade_smooth:
|
||||
bpy.ops.object.shade_smooth()
|
||||
else:
|
||||
bpy.ops.object.shade_flat()
|
||||
bpy.ops.object.shade_flat()
|
||||
|
||||
# Delete main splines
|
||||
bpy.ops.object.mode_set('INVOKE_REGION_WIN', mode='OBJECT')
|
||||
|
@ -4318,7 +4318,7 @@ def conver_gpencil_to_curve(self, context, pencil, type):
|
|||
if not error:
|
||||
for i, _stroke in enumerate(strokes):
|
||||
stroke_points = strokes[i].points
|
||||
data_list = [ (point.co.x, point.co.y, point.co.z)
|
||||
data_list = [ (point.co.x, point.co.y, point.co.z)
|
||||
for point in stroke_points ]
|
||||
points_to_add = len(data_list)-1
|
||||
|
||||
|
|
|
@ -3867,7 +3867,7 @@ class RemoveAnnotation(Operator):
|
|||
return {'CANCELLED'}
|
||||
|
||||
return{'FINISHED'}
|
||||
|
||||
|
||||
# GPencil operator
|
||||
class RemoveGPencil(Operator):
|
||||
bl_idname = "remove.gp"
|
||||
|
@ -3997,7 +3997,7 @@ class GStretch(Operator):
|
|||
looptools = context.window_manager.looptools
|
||||
layout = self.layout
|
||||
col = layout.column()
|
||||
|
||||
|
||||
col.prop(self, "method")
|
||||
col.separator()
|
||||
|
||||
|
@ -4373,7 +4373,7 @@ class Space(Operator):
|
|||
if derived:
|
||||
bm_mod.free()
|
||||
terminate()
|
||||
|
||||
|
||||
cache_delete("Space")
|
||||
|
||||
return{'FINISHED'}
|
||||
|
|
|
@ -29,9 +29,9 @@ def failure_message(self):
|
|||
|
||||
def failure_message_on_plane(self):
|
||||
msg2 = """\
|
||||
Edge2Face expects the edge to intersect at one point on the plane of the selected face. You're
|
||||
seeing this warning because mathutils.geometry.intersect_line_plane is being called on an edge/face
|
||||
combination that has no clear intersection point ( both points of the edge either touch the same
|
||||
Edge2Face expects the edge to intersect at one point on the plane of the selected face. You're
|
||||
seeing this warning because mathutils.geometry.intersect_line_plane is being called on an edge/face
|
||||
combination that has no clear intersection point ( both points of the edge either touch the same
|
||||
plane as the face or they lie in a plane that is offset along the face's normal )"""
|
||||
lines = msg2.split('\n')
|
||||
for line in lines:
|
||||
|
|
|
@ -707,7 +707,7 @@ class MESH_OT_face_inset_fillet(Operator):
|
|||
edit_mode_in()
|
||||
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# ********** Edit Multiselect **********
|
||||
class VIEW3D_MT_Edit_MultiMET(Menu):
|
||||
bl_label = "Multi Select"
|
||||
|
@ -897,7 +897,7 @@ class VIEW3D_MT_edit_mesh_tools(Menu):
|
|||
text="Multi Extrude")
|
||||
layout.operator('mesh.split_solidify', text="Split Solidify")
|
||||
|
||||
|
||||
|
||||
|
||||
# panel containing all tools
|
||||
class VIEW3D_PT_edit_mesh_tools(Panel):
|
||||
|
@ -1017,7 +1017,7 @@ class VIEW3D_PT_edit_mesh_tools(Panel):
|
|||
row.operator("mesh.tris_convert_to_quads")
|
||||
row = col_top.row(align=True)
|
||||
row.operator("mesh.relax")
|
||||
|
||||
|
||||
# property group containing all properties for the gui in the panel
|
||||
class EditToolsProps(PropertyGroup):
|
||||
"""
|
||||
|
|
|
@ -1371,12 +1371,12 @@ class EdgeRoundifier(Operator):
|
|||
@classmethod
|
||||
def poll(cls, context):
|
||||
return (context.view_layer.objects.active.type == 'MESH') and (context.view_layer.objects.active.mode == 'EDIT')
|
||||
|
||||
|
||||
def draw_item(self, context):
|
||||
self.layout.operator_context = 'INVOKE_DEFAULT'
|
||||
self.layout.operator('mesh.edge_roundifier')
|
||||
|
||||
|
||||
|
||||
classes = (
|
||||
EdgeRoundifier,
|
||||
)
|
||||
|
|
|
@ -573,7 +573,7 @@ class OffsetEdges(bpy.types.Operator):
|
|||
row.prop(self, d_mode)
|
||||
row.prop(self, flip, icon='ARROW_LEFTRIGHT', icon_only=True)
|
||||
if self.depth_mode == 'angle':
|
||||
layout.prop(self, 'angle_presets', text="Presets", expand=True)
|
||||
layout.prop(self, 'angle_presets', text="Presets", expand=True)
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@ -769,7 +769,7 @@ class OffsetEdgesMenu(bpy.types.Menu):
|
|||
classes = (
|
||||
OffsetEdges,
|
||||
OffsetEdgesMenu,
|
||||
)
|
||||
)
|
||||
|
||||
def draw_item(self, context):
|
||||
self.layout.menu("VIEW3D_MT_edit_mesh_offset_edges")
|
||||
|
|
|
@ -229,14 +229,14 @@ def nodemargin(self, context):
|
|||
for i in ntree.nodes:
|
||||
if i.type == 'GROUP':
|
||||
n_groups.append(i)
|
||||
|
||||
|
||||
while n_groups:
|
||||
j = n_groups.pop(0)
|
||||
nodes_iterate(j.node_tree)
|
||||
for i in j.node_tree.nodes:
|
||||
if i.type == 'GROUP':
|
||||
n_groups.append(i)
|
||||
|
||||
|
||||
nodes_iterate(ntree)
|
||||
|
||||
# arrange nodes + this center nodes together
|
||||
|
|
|
@ -85,7 +85,7 @@ def update_collection_tree(context):
|
|||
def get_all_collections(context, collections, parent, tree, level=0, visible=False):
|
||||
global row_index
|
||||
global max_lvl
|
||||
|
||||
|
||||
if level > max_lvl:
|
||||
max_lvl = level
|
||||
|
||||
|
@ -164,10 +164,10 @@ class CMSendReport(Operator):
|
|||
layout.row().label(text=string, icon='ERROR')
|
||||
else:
|
||||
layout.row().label(text=string, icon='BLANK1')
|
||||
|
||||
|
||||
def invoke(self, context, event):
|
||||
wm = context.window_manager
|
||||
|
||||
|
||||
max_len = 0
|
||||
length = 0
|
||||
|
||||
|
|
|
@ -1141,10 +1141,10 @@ class CMPhantomModeOperator(Operator):
|
|||
for rto, history, in rto_history.items():
|
||||
if view_layer in history:
|
||||
del history[view_layer]
|
||||
|
||||
|
||||
if phantom_history[rto+"_history"]:
|
||||
history[view_layer] = deepcopy(phantom_history[rto+"_history"])
|
||||
|
||||
|
||||
phantom_history[rto+"_history"].clear()
|
||||
|
||||
scn.CM_Phantom_Mode = False
|
||||
|
|
|
@ -262,7 +262,7 @@ classes = (
|
|||
|
||||
|
||||
def register():
|
||||
bpy.app.handlers.load_post.append(linked_file_check)
|
||||
bpy.app.handlers.load_post.append(linked_file_check)
|
||||
|
||||
for c in classes:
|
||||
bpy.utils.register_class(c)
|
||||
|
@ -278,15 +278,15 @@ def register():
|
|||
default=False)
|
||||
|
||||
# add the function to the file menu
|
||||
bpy.types.TOPBAR_MT_file_external_data.append(TOPBAR_MT_edit_linked_submenu.draw)
|
||||
bpy.types.TOPBAR_MT_file_external_data.append(TOPBAR_MT_edit_linked_submenu.draw)
|
||||
|
||||
|
||||
|
||||
|
||||
def unregister():
|
||||
|
||||
bpy.app.handlers.load_post.remove(linked_file_check)
|
||||
bpy.types.TOPBAR_MT_file_external_data.remove(TOPBAR_MT_edit_linked_submenu)
|
||||
bpy.app.handlers.load_post.remove(linked_file_check)
|
||||
bpy.types.TOPBAR_MT_file_external_data.remove(TOPBAR_MT_edit_linked_submenu)
|
||||
|
||||
del bpy.types.Scene.use_autosave
|
||||
del bpy.types.Scene.use_instance
|
||||
|
|
|
@ -29,7 +29,7 @@ bl_info = {
|
|||
"wiki_url": "https://www.oscurart.com.ar",
|
||||
"category": "Object",
|
||||
}
|
||||
|
||||
|
||||
|
||||
import bpy
|
||||
from bpy.app.handlers import persistent
|
||||
|
@ -67,16 +67,16 @@ from bpy.props import (
|
|||
|
||||
# mesh
|
||||
class VIEW3D_MT_edit_mesh_oscurarttools(Menu):
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
layout.operator("mesh.uv_island_copy")
|
||||
layout.operator("mesh.uv_island_paste")
|
||||
layout.operator("mesh.select_doubles")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
@ -87,17 +87,17 @@ def menu_funcMesh(self, context):
|
|||
|
||||
# image
|
||||
class IMAGE_MT_uvs_oscurarttools(Menu):
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
|
||||
layout.operator("mesh.uv_island_copy")
|
||||
layout.operator("mesh.uv_island_paste")
|
||||
layout.operator("mesh.overlap_uv_faces")
|
||||
layout.operator("mesh.select_flipped_uvs")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("mesh.select_flipped_uvs")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
@ -110,19 +110,19 @@ def menu_funcImage(self, context):
|
|||
|
||||
# object
|
||||
class VIEW3D_MT_object_oscurarttools(Menu):
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
bl_label = "OscurartTools"
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.operator("mesh.vertex_color_mask")
|
||||
|
||||
layout.operator("mesh.vertex_color_mask")
|
||||
layout.operator("object.distribute_osc")
|
||||
layout.operator("mesh.remove_modifiers")
|
||||
layout.operator("object.search_and_select_osc")
|
||||
layout.operator("object.shape_key_to_objects_osc")
|
||||
layout.operator("mesh.apply_linked_meshes")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("mesh.apply_linked_meshes")
|
||||
layout.separator()
|
||||
layout.operator("image.reload_images_osc")
|
||||
layout.operator("file.save_incremental_backup")
|
||||
layout.operator("file.collect_all_images")
|
||||
layout.operator("file.create_batch_maker_osc")
|
||||
|
@ -138,8 +138,8 @@ classes = (
|
|||
VIEW3D_MT_edit_mesh_oscurarttools,
|
||||
IMAGE_MT_uvs_oscurarttools,
|
||||
VIEW3D_MT_object_oscurarttools,
|
||||
reload_images.reloadImages,
|
||||
overlap_uvs.CopyUvIsland,
|
||||
reload_images.reloadImages,
|
||||
overlap_uvs.CopyUvIsland,
|
||||
overlap_uvs.PasteUvIsland,
|
||||
distribute.DistributeOsc,
|
||||
selection.OSSELECTION_HT_OscSelection,
|
||||
|
@ -163,23 +163,23 @@ classes = (
|
|||
flipped_uvs.selectFlippedUvs
|
||||
)
|
||||
|
||||
def register():
|
||||
def register():
|
||||
from bpy.types import Scene
|
||||
Scene.multimeshedit = StringProperty()
|
||||
bpy.types.VIEW3D_MT_edit_mesh_context_menu.prepend(menu_funcMesh)
|
||||
bpy.types.IMAGE_MT_uvs_context_menu.prepend(menu_funcImage)
|
||||
bpy.types.VIEW3D_MT_object_context_menu.prepend(menu_funcObject)
|
||||
bpy.app.handlers.render_init.append(render_tokens.replaceTokens)
|
||||
bpy.app.handlers.render_cancel.append(render_tokens.restoreTokens)
|
||||
bpy.app.handlers.render_complete.append(render_tokens.restoreTokens)
|
||||
bpy.app.handlers.render_pre.append(material_overrides.ApplyOverrides)
|
||||
bpy.app.handlers.render_cancel.append(material_overrides.RestoreOverrides)
|
||||
bpy.app.handlers.render_post.append(material_overrides.RestoreOverrides)
|
||||
|
||||
bpy.app.handlers.render_cancel.append(render_tokens.restoreTokens)
|
||||
bpy.app.handlers.render_complete.append(render_tokens.restoreTokens)
|
||||
bpy.app.handlers.render_pre.append(material_overrides.ApplyOverrides)
|
||||
bpy.app.handlers.render_cancel.append(material_overrides.RestoreOverrides)
|
||||
bpy.app.handlers.render_post.append(material_overrides.RestoreOverrides)
|
||||
|
||||
from bpy.utils import register_class
|
||||
for cls in classes:
|
||||
register_class(cls)
|
||||
|
||||
register_class(cls)
|
||||
|
||||
|
||||
def unregister():
|
||||
bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(menu_funcMesh)
|
||||
|
|
|
@ -26,34 +26,34 @@ import os
|
|||
def saveBkp (self, context):
|
||||
fileFolder = os.path.dirname(bpy.data.filepath)
|
||||
versionFolder = os.path.join(fileFolder,"VERSIONS")
|
||||
|
||||
|
||||
#creo folder
|
||||
if os.path.exists(versionFolder):
|
||||
print("existe")
|
||||
else:
|
||||
os.mkdir(versionFolder)
|
||||
|
||||
os.mkdir(versionFolder)
|
||||
|
||||
#sin version a versionada
|
||||
if not bpy.data.filepath.count("_v"):
|
||||
filelist = [file for file in os.listdir(versionFolder) if file.count("_v") and not file.count("blend1")]
|
||||
if not bpy.data.filepath.count("_v"):
|
||||
filelist = [file for file in os.listdir(versionFolder) if file.count("_v") and not file.count("blend1")]
|
||||
|
||||
filelower = 0
|
||||
print(filelist)
|
||||
for file in filelist:
|
||||
if int(file.split(".")[0][-2:]) > filelower:
|
||||
filelower = int(file.split(".")[0][-2:])
|
||||
filelower = int(file.split(".")[0][-2:])
|
||||
|
||||
savepath = "%s/VERSIONS/%s_v%02d.blend" % (os.path.dirname(bpy.data.filepath),bpy.path.basename(bpy.data.filepath).split('.')[0],filelower+1)
|
||||
print("Copia versionada guardada.")
|
||||
savepath = "%s/VERSIONS/%s_v%02d.blend" % (os.path.dirname(bpy.data.filepath),bpy.path.basename(bpy.data.filepath).split('.')[0],filelower+1)
|
||||
print("Copia versionada guardada.")
|
||||
bpy.ops.wm.save_as_mainfile()
|
||||
bpy.ops.wm.save_as_mainfile(filepath=savepath, copy=True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=savepath, copy=True)
|
||||
|
||||
else:
|
||||
else:
|
||||
#versionada a sin version
|
||||
if bpy.data.filepath.count("_v"):
|
||||
filename = "%s/../%s.blend" % (os.path.dirname(bpy.data.filepath),os.path.basename(bpy.data.filepath).rpartition(".")[0].rpartition("_")[0])
|
||||
print(filename)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=filename, copy=True)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=filename, copy=True)
|
||||
print("Copia sin version guardada.")
|
||||
|
||||
|
||||
|
@ -66,5 +66,5 @@ class saveIncrementalBackup (bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
saveBkp(self, context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ def applyLRTEx(self, context):
|
|||
actObj.rotation_euler = (0,0,0)
|
||||
actObj.scale = (1,1,1)
|
||||
|
||||
for ob in linkedObjects:
|
||||
for ob in linkedObjects:
|
||||
ob.matrix_world = ob.matrix_world @ actObj.matrix_world.inverted()
|
||||
|
||||
|
||||
|
@ -53,8 +53,8 @@ class ApplyLRT(bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
applyLRTEx(self, context)
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,18 +25,18 @@ import bmesh
|
|||
def defSelectFlippedUvs(self, context):
|
||||
bm = bmesh.from_edit_mesh(bpy.context.active_object.data)
|
||||
bpy.context.scene.tool_settings.use_uv_select_sync = True
|
||||
|
||||
|
||||
uvLayer = bm.loops.layers.uv.verify()
|
||||
|
||||
|
||||
|
||||
for face in bm.faces:
|
||||
sum_edges = 0
|
||||
|
||||
|
||||
for i in range(3):
|
||||
uv_A = face.loops[i][uvLayer].uv
|
||||
uv_B = face.loops[(i+1)%3][uvLayer].uv
|
||||
sum_edges += uv_B.cross(uv_A)
|
||||
|
||||
|
||||
if sum_edges > 0:
|
||||
face.select_set(True)
|
||||
|
||||
|
|
|
@ -49,8 +49,8 @@ def vertexColorMask(self,context):
|
|||
for loop in face.loops:
|
||||
loop[color_layer] = color
|
||||
bpy.ops.object.mode_set(mode="VERTEX_PAINT")
|
||||
|
||||
|
||||
|
||||
|
||||
class createVCMask(bpy.types.Operator):
|
||||
bl_idname = "mesh.vertex_color_mask"
|
||||
bl_label = "Vertex Color Mask"
|
||||
|
|
|
@ -57,6 +57,6 @@ class SearchAndSelectOt(bpy.types.Operator):
|
|||
self.count = True
|
||||
self.end = True
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ def batchMaker(BIN):
|
|||
else:
|
||||
for scene in bpy.data.scenes:
|
||||
FILE.writelines("blender -b '%s' --scene %s --python-text Text -a \n" % (bpy.data.filepath,scene.name))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class oscBatchMaker (bpy.types.Operator):
|
||||
"""It creates .bat(win) or .sh(unix) file, to execute and render from Console/Terminal"""
|
||||
|
|
|
@ -8,31 +8,31 @@ from bpy.app.handlers import persistent
|
|||
|
||||
@persistent
|
||||
def ApplyOverrides(dummy):
|
||||
global obDict
|
||||
global obDict
|
||||
|
||||
for override in bpy.context.scene.ovlist:
|
||||
for ob in bpy.data.collections[override.grooverride].all_objects:
|
||||
if ob.type == "MESH":
|
||||
if not ob.hide_viewport and not ob.hide_render:
|
||||
obDict.append([ob,[mat for mat in ob.data.materials]])
|
||||
obDict.append([ob,[mat for mat in ob.data.materials]])
|
||||
|
||||
for override in bpy.context.scene.ovlist:
|
||||
for ob in bpy.data.collections[override.grooverride].all_objects:
|
||||
if ob.type == "MESH":
|
||||
if not ob.hide_viewport and not ob.hide_render:
|
||||
for i,mat in enumerate(ob.data.materials):
|
||||
ob.data.materials[i] = bpy.data.materials[override.matoverride]
|
||||
ob.data.materials[i] = bpy.data.materials[override.matoverride]
|
||||
|
||||
|
||||
@persistent
|
||||
def RestoreOverrides(dummy):
|
||||
global obDict
|
||||
|
||||
|
||||
for set in obDict:
|
||||
for i,mat in enumerate(set[1]):
|
||||
set[0].data.materials[i] = mat
|
||||
|
||||
obDict = []
|
||||
|
||||
obDict = []
|
||||
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
@ -42,9 +42,9 @@ def RestoreOverrides(dummy):
|
|||
class OscOverridesProp(bpy.types.PropertyGroup):
|
||||
matoverride: bpy.props.StringProperty()
|
||||
grooverride: bpy.props.StringProperty()
|
||||
|
||||
bpy.utils.register_class(OscOverridesProp)
|
||||
bpy.types.Scene.ovlist = bpy.props.CollectionProperty(type=OscOverridesProp)
|
||||
|
||||
bpy.utils.register_class(OscOverridesProp)
|
||||
bpy.types.Scene.ovlist = bpy.props.CollectionProperty(type=OscOverridesProp)
|
||||
|
||||
|
||||
class OVERRIDES_PT_OscOverridesGUI(bpy.types.Panel):
|
||||
|
@ -174,5 +174,5 @@ class OscOverridesKill(bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
ovlist = context.scene.ovlist
|
||||
ovlist.remove(self.index)
|
||||
return {'FINISHED'}
|
||||
return {'FINISHED'}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ def replaceTokens (dummy):
|
|||
"$File":os.path.basename(bpy.data.filepath).split(".")[0],
|
||||
"$ViewLayer":bpy.context.view_layer.name,
|
||||
"$Camera":bpy.context.scene.camera.name}
|
||||
|
||||
|
||||
renpath = bpy.context.scene.render.filepath
|
||||
|
||||
|
||||
bpy.context.scene.render.filepath = renpath.replace("$Scene",tokens["$Scene"]).replace("$File",tokens["$File"]).replace("$ViewLayer",tokens["$ViewLayer"]).replace("$Camera",tokens["$Camera"])
|
||||
print(bpy.context.scene.render.filepath)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#(1700K) 135W Low Pressure Sodium Vapor Starting from 1932
|
||||
#Mostly used for Outdoor city lighting, security lighting, long tunnel lighting
|
||||
#Mostly used for Outdoor city lighting, security lighting, long tunnel lighting
|
||||
|
||||
import bpy
|
||||
bpy.context.object.data.type = 'POINT'
|
||||
|
|
|
@ -2,7 +2,7 @@ import bpy
|
|||
scene = bpy.context.scene
|
||||
|
||||
scene.world.pov.use_sky_blend = True
|
||||
#below multiplied by two for a better proportion Clear vs Overcast sky
|
||||
#below multiplied by two for a better proportion Clear vs Overcast sky
|
||||
#since Clear sky is 20000 lux vs 2000 for overcast
|
||||
scene.world.pov.horizon_color = (0.350*2, 0.611*2, 1.0*2)
|
||||
scene.world.pov.zenith_color = (0.05000000074505806*2, 0.125*2, 0.5*2)
|
||||
|
|
|
@ -2,7 +2,7 @@ import bpy
|
|||
scene = bpy.context.scene
|
||||
|
||||
scene.world.pov.use_sky_blend = True
|
||||
#below multiplied by two for a better proportion Clear vs Overcast sky
|
||||
#below multiplied by two for a better proportion Clear vs Overcast sky
|
||||
#since Clear sky is 20000 lux vs 2000 for overcast
|
||||
scene.world.pov.horizon_color = (0.0, 0.0, 0.0)
|
||||
scene.world.pov.zenith_color = (0.250980406999588, 0.6117647290229797, 1.0)
|
||||
|
|
|
@ -69,12 +69,12 @@ addon_files = (
|
|||
symmetry_menu,
|
||||
texture_menu,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
class VIEW3D_MT_Brushes_Pref(AddonPreferences):
|
||||
bl_idname = __name__
|
||||
|
||||
|
||||
column_set: IntProperty(
|
||||
name="Number of Columns",
|
||||
description="Number of columns used for the brushes menu",
|
||||
|
@ -99,10 +99,10 @@ def register():
|
|||
# register all files
|
||||
for addon_file in addon_files:
|
||||
addon_file.register()
|
||||
|
||||
|
||||
# set the add-on name variable to access the preferences
|
||||
utils_core.get_addon_name = __name__
|
||||
|
||||
|
||||
# register preferences
|
||||
bpy.utils.register_class(VIEW3D_MT_Brushes_Pref)
|
||||
|
||||
|
@ -121,10 +121,10 @@ def unregister():
|
|||
# unregister all files
|
||||
for addon_file in addon_files:
|
||||
addon_file.unregister()
|
||||
|
||||
|
||||
# unregister preferences
|
||||
bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
|
||||
|
||||
|
||||
for km, kmi in addon_keymaps:
|
||||
km.keymap_items.remove(kmi)
|
||||
addon_keymaps.clear()
|
||||
|
|
|
@ -25,7 +25,7 @@ class BrushOptionsMenu(Menu):
|
|||
def draw(self, context):
|
||||
mode = utils_core.get_mode()
|
||||
layout = self.layout
|
||||
|
||||
|
||||
# add generic menu items
|
||||
layout.operator_context = 'INVOKE_REGION_WIN'
|
||||
layout.operator("wm.search_menu", text="Search", icon='VIEWZOOM')
|
||||
|
@ -34,8 +34,8 @@ class BrushOptionsMenu(Menu):
|
|||
layout.operator_menu_enum("object.mode_set", "mode",
|
||||
text="Interactive Mode", icon='VIEW3D')
|
||||
layout.separator()
|
||||
|
||||
|
||||
|
||||
|
||||
# add mode specific menu items
|
||||
if mode == 'SCULPT':
|
||||
self.sculpt(mode, layout, context)
|
||||
|
@ -53,7 +53,7 @@ class BrushOptionsMenu(Menu):
|
|||
has_brush = utils_core.get_brush_link(context, types="brush")
|
||||
icons = brushes.brush_icon[mode][has_brush.sculpt_tool] if \
|
||||
has_brush else "BRUSH_DATA"
|
||||
|
||||
|
||||
layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
|
||||
icon=icons)
|
||||
|
||||
|
@ -75,8 +75,8 @@ class BrushOptionsMenu(Menu):
|
|||
has_brush = utils_core.get_brush_link(context, types="brush")
|
||||
icons = brushes.brush_icon[mode][has_brush.vertex_tool] if \
|
||||
has_brush else "BRUSH_DATA"
|
||||
|
||||
if mode == 'VERTEX_PAINT':
|
||||
|
||||
if mode == 'VERTEX_PAINT':
|
||||
layout.row().operator(ColorPickerPopup.bl_idname, icon="COLOR")
|
||||
layout.row().separator()
|
||||
|
||||
|
@ -107,7 +107,7 @@ class BrushOptionsMenu(Menu):
|
|||
|
||||
def texpaint(self, mode, layout, context):
|
||||
toolsettings = context.tool_settings.image_paint
|
||||
|
||||
|
||||
has_brush = utils_core.get_brush_link(context, types="brush")
|
||||
icons = brushes.brush_icon[mode][has_brush.image_tool] if \
|
||||
has_brush else "BRUSH_DATA"
|
||||
|
@ -116,36 +116,36 @@ class BrushOptionsMenu(Menu):
|
|||
if toolsettings.missing_uvs:
|
||||
layout.row().label(text="Missing UVs", icon='ERROR')
|
||||
layout.row().operator("paint.add_simple_uvs")
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
elif toolsettings.missing_materials or toolsettings.missing_texture:
|
||||
layout.row().label(text="Missing Data", icon='ERROR')
|
||||
layout.row().operator_menu_enum("paint.add_texture_paint_slot", \
|
||||
"type", \
|
||||
icon='ADD', \
|
||||
text="Add Texture Paint Slot")
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
elif toolsettings.missing_stencil:
|
||||
layout.row().label(text="Missing Data", icon='ERROR')
|
||||
layout.row().label(text="See Mask Properties", icon='FORWARD')
|
||||
layout.row().separator()
|
||||
layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
|
||||
icon=icons)
|
||||
|
||||
|
||||
return
|
||||
|
||||
|
||||
else:
|
||||
layout.row().label(text="Missing Data", icon="INFO")
|
||||
|
||||
|
||||
else:
|
||||
if has_brush and has_brush.image_tool in {'DRAW', 'FILL'} and \
|
||||
has_brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'}:
|
||||
layout.row().operator(ColorPickerPopup.bl_idname, icon="COLOR")
|
||||
layout.row().separator()
|
||||
|
||||
|
||||
layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
|
||||
icon=icons)
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ class BrushesMenu(Menu):
|
|||
)
|
||||
else:
|
||||
column_flow = layout.column_flow(columns=colum_n)
|
||||
|
||||
|
||||
# iterate over all the brushes
|
||||
for item in bpy.data.brushes:
|
||||
if mode == 'SCULPT':
|
||||
|
|
|
@ -47,7 +47,7 @@ class PIE_MT_PieApplyTransforms(Menu):
|
|||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# 4 - LEFT
|
||||
pie.operator("object.visual_transform_apply", text="Apply Visual")
|
||||
pie.operator("object.visual_transform_apply", text="Apply Visual")
|
||||
# 6 - RIGHT
|
||||
pie.operator("apply.transformall", text="Apply All")
|
||||
# 2 - BOTTOM
|
||||
|
|
|
@ -78,7 +78,7 @@ class PIE_MT_AreaTypePieOther(Menu):
|
|||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="File Browser", icon="FILEBROWSER").types = "FILE_BROWSER"
|
||||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Preferences",
|
||||
icon="PREFERENCES").types = "PREFERENCES"
|
||||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Text Editor", icon="TEXT").types = "TEXT_EDITOR"
|
||||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Text Editor", icon="TEXT").types = "TEXT_EDITOR"
|
||||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Python Console", icon="CONSOLE").types = "CONSOLE"
|
||||
self.layout.operator(PIE_OT_SetAreaType.bl_idname, text="Info", icon="INFO").types = "INFO"
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class PIE_OT_SetObjectModePie(Operator):
|
|||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Edit Selection Modes
|
||||
# Edit Selection Modes
|
||||
class PIE_OT_ClassVertex(Operator):
|
||||
bl_idname = "class.vertex"
|
||||
bl_label = "Class Vertex"
|
||||
|
@ -223,7 +223,7 @@ class PIE_MT_ObjectEditMode(Menu):
|
|||
ob = context.object
|
||||
# No Object Selected #
|
||||
if not ob or not ob.select_get():
|
||||
message = "No Active Object Selected"
|
||||
message = "No Active Object Selected"
|
||||
pie = layout.menu_pie()
|
||||
pie.separator()
|
||||
pie.separator()
|
||||
|
@ -383,7 +383,7 @@ class PIE_MT_ObjectEditMode(Menu):
|
|||
|
||||
|
||||
elif ob and ob.type in {"LIGHT", "CAMERA", "EMPTY", "SPEAKER"}:
|
||||
message = "Active Object has only Object Mode available"
|
||||
message = "Active Object has only Object Mode available"
|
||||
pie = layout.menu_pie()
|
||||
pie.separator()
|
||||
pie.separator()
|
||||
|
@ -408,7 +408,7 @@ classes = (
|
|||
)
|
||||
|
||||
addon_keymaps = []
|
||||
|
||||
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
|
|
|
@ -267,7 +267,7 @@ class PIE_MT_OriginPivot(Menu):
|
|||
icon='NONE').type = 'ORIGIN_GEOMETRY'
|
||||
|
||||
|
||||
elif obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
|
||||
elif obj and obj.type == 'MESH' and obj.mode in {'EDIT'}:
|
||||
# 4 - LEFT
|
||||
pie.operator("object.origintomass_edit", text="Origin to Center of Mass",
|
||||
icon='NONE')
|
||||
|
@ -279,7 +279,7 @@ class PIE_MT_OriginPivot(Menu):
|
|||
icon='TRIA_DOWN')
|
||||
# 8 - TOP
|
||||
pie.operator("object.setorigintoselected_edit", text="Origin To Selected",
|
||||
icon='SNAP_INCREMENT')
|
||||
icon='SNAP_INCREMENT')
|
||||
# 7 - TOP - LEFT
|
||||
pie.operator("object.geometrytoorigin_edit", text="Geometry To Origin",
|
||||
icon='NONE')
|
||||
|
|
|
@ -298,7 +298,7 @@ class PIE_OT_ProportionalRandomEdt(Operator):
|
|||
ts.use_proportional_edit = True
|
||||
ts.proportional_edit_falloff = 'RANDOM'
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class PIE_OT_ProportionalInverseSquareEdt(Operator):
|
||||
bl_idname = "proportional_edt.inversesquare"
|
||||
bl_label = "Proportional Inverese Square EditMode"
|
||||
|
|
|
@ -379,7 +379,7 @@ class VIEW3D_MT_Space_Dynamic_Menu(Menu):
|
|||
layout.operator("mball.duplicate_metaelems", icon='OUTLINER_DATA_META')
|
||||
layout.menu("VIEW3D_MT_edit_meta_showhide", icon='HIDE_OFF')
|
||||
UseSeparator(self, context)
|
||||
layout.operator("mball.delete_metaelems", text="Delete", icon='X')
|
||||
layout.operator("mball.delete_metaelems", text="Delete", icon='X')
|
||||
UseSeparator(self, context)
|
||||
layout.menu("VIEW3D_MT_UndoS", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
|
|
Loading…
Reference in New Issue