[Bf-extensions-cvs] [246de4dc] master: Curve Tools 2: Update panel Rename, Cleanup
lijenstina
noreply at git.blender.org
Sat Jul 8 20:50:41 CEST 2017
Commit: 246de4dcde85e43a30baf4c61f37ac385242eb18
Author: lijenstina
Date: Sat Jul 8 20:49:49 2017 +0200
Branches: master
https://developer.blender.org/rBAC246de4dcde85e43a30baf4c61f37ac385242eb18
Curve Tools 2: Update panel Rename, Cleanup
Bumped version to 0.2.1
As a part of the task T50726:
Update the Panel rename code to more generic one
PEP8 cleanup:
Consistent Scene props definitions
Update url link
Fix crash with the curve.bezier_spline_divide operator
missing since it is moved to add_curve_extra_objects
Commented out the entry
Fix crash with the panel poll if active object is None
===================================================================
M curve_tools/__init__.py
===================================================================
diff --git a/curve_tools/__init__.py b/curve_tools/__init__.py
index 54fc1094..9ae4f567 100644
--- a/curve_tools/__init__.py
+++ b/curve_tools/__init__.py
@@ -2,25 +2,30 @@ bl_info = {
"name": "Curve Tools 2",
"description": "Adds some functionality for bezier/nurbs curve/surface modeling",
"author": "Mackraken, guy lateur",
- "version": (0, 2, 0),
+ "version": (0, 2, 1),
"blender": (2, 71, 0),
"location": "View3D > Tool Shelf > Addons Tab",
"warning": "WIP",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
"Scripts/Curve/Curve_Tools",
"tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
"category": "Add Curve"}
import bpy
+from bpy.types import (
+ Operator,
+ Panel,
+ PropertyGroup,
+ )
from bpy.props import (
BoolProperty,
IntProperty,
FloatProperty,
EnumProperty,
CollectionProperty,
+ StringProperty,
)
-
from . import Properties
from . import Operators
from . import auto_loft
@@ -41,8 +46,7 @@ def UpdateDummy(object, context):
UTILSDROP = scene.UTUtilsDrop
-class SeparateOutline(bpy.types.Operator):
- """Curve Outliner"""
+class SeparateOutline(Operator):
bl_idname = "object.sep_outline"
bl_label = "Separate Outline"
bl_options = {'REGISTER', 'UNDO'}
@@ -61,104 +65,109 @@ class SeparateOutline(bpy.types.Operator):
return {'FINISHED'}
-class CurveTools2Settings(bpy.types.PropertyGroup):
+class CurveTools2Settings(PropertyGroup):
# selection
SelectedObjects = CollectionProperty(
- type=Properties.CurveTools2SelectedObject
- )
+ type=Properties.CurveTools2SelectedObject
+ )
NrSelectedObjects = IntProperty(
- name="NrSelectedObjects",
- default=0,
- description="Number of selected objects",
- update=UpdateDummy
- )
- # NrSelectedObjects = IntProperty(name="NrSelectedObjects", default=0, description="Number of selected objects")
-
+ name="NrSelectedObjects",
+ default=0,
+ description="Number of selected objects",
+ update=UpdateDummy
+ )
+ """
+ NrSelectedObjects = IntProperty(
+ name="NrSelectedObjects",
+ default=0,
+ description="Number of selected objects"
+ )
+ """
# curve
CurveLength = FloatProperty(
- name="CurveLength",
- default=0.0,
- precision=6
- )
+ name="CurveLength",
+ default=0.0,
+ precision=6
+ )
# splines
SplineResolution = IntProperty(
- name="SplineResolution",
- default=64,
- min=2, max=1024,
- soft_min=2,
- description="Spline resolution will be set to this value"
- )
+ name="SplineResolution",
+ default=64,
+ min=2, max=1024,
+ soft_min=2,
+ description="Spline resolution will be set to this value"
+ )
SplineRemoveLength = FloatProperty(
- name="SplineRemoveLength",
- default=0.001,
- precision=6,
- description="Splines shorter than this threshold length will be removed"
- )
+ name="SplineRemoveLength",
+ default=0.001,
+ precision=6,
+ description="Splines shorter than this threshold length will be removed"
+ )
SplineJoinDistance = FloatProperty(
- name="SplineJoinDistance",
- default=0.001,
- precision=6,
- description="Splines with starting/ending points closer to each other "
- "than this threshold distance will be joined"
- )
+ name="SplineJoinDistance",
+ default=0.001,
+ precision=6,
+ description="Splines with starting/ending points closer to each other "
+ "than this threshold distance will be joined"
+ )
SplineJoinStartEnd = BoolProperty(
- name="SplineJoinStartEnd",
- default=False,
- description="Only join splines at the starting point of one and the ending point of the other"
- )
+ name="SplineJoinStartEnd",
+ default=False,
+ description="Only join splines at the starting point of one and the ending point of the other"
+ )
splineJoinModeItems = (
- ('At midpoint', 'At midpoint', 'Join splines at midpoint of neighbouring points'),
- ('Insert segment', 'Insert segment', 'Insert segment between neighbouring points')
- )
+ ('At midpoint', 'At midpoint', 'Join splines at midpoint of neighbouring points'),
+ ('Insert segment', 'Insert segment', 'Insert segment between neighbouring points')
+ )
SplineJoinMode = EnumProperty(
- items=splineJoinModeItems,
- name="SplineJoinMode",
- default='At midpoint',
- description="Determines how the splines will be joined"
- )
+ items=splineJoinModeItems,
+ name="SplineJoinMode",
+ default='At midpoint',
+ description="Determines how the splines will be joined"
+ )
# curve intersection
LimitDistance = FloatProperty(
- name="LimitDistance",
- default=0.0001,
- precision=6,
- description="Displays the result of the curve length calculation"
- )
+ name="LimitDistance",
+ default=0.0001,
+ precision=6,
+ description="Displays the result of the curve length calculation"
+ )
intAlgorithmItems = (
- ('3D', '3D', 'Detect where curves intersect in 3D'),
- ('From View', 'From View', 'Detect where curves intersect in the RegionView3D')
- )
+ ('3D', '3D', 'Detect where curves intersect in 3D'),
+ ('From View', 'From View', 'Detect where curves intersect in the RegionView3D')
+ )
IntersectCurvesAlgorithm = EnumProperty(
- items=intAlgorithmItems,
- name="IntersectCurvesAlgorithm",
- description="Determines how the intersection points will be detected",
- default='3D'
- )
+ items=intAlgorithmItems,
+ name="IntersectCurvesAlgorithm",
+ description="Determines how the intersection points will be detected",
+ default='3D'
+ )
intModeItems = (
- ('Insert', 'Insert', 'Insert points into the existing spline(s)'),
- ('Split', 'Split', 'Split the existing spline(s) into 2'),
- ('Empty', 'Empty', 'Add empty at intersections')
- )
+ ('Insert', 'Insert', 'Insert points into the existing spline(s)'),
+ ('Split', 'Split', 'Split the existing spline(s) into 2'),
+ ('Empty', 'Empty', 'Add empty at intersections')
+ )
IntersectCurvesMode = EnumProperty(
- items=intModeItems,
- name="IntersectCurvesMode",
- description="Determines what happens at the intersection points",
- default='Split'
- )
+ items=intModeItems,
+ name="IntersectCurvesMode",
+ description="Determines what happens at the intersection points",
+ default='Split'
+ )
intAffectItems = (
- ('Both', 'Both', 'Insert points into both curves'),
- ('Active', 'Active', 'Insert points into active curve only'),
- ('Other', 'Other', 'Insert points into other curve only')
- )
+ ('Both', 'Both', 'Insert points into both curves'),
+ ('Active', 'Active', 'Insert points into active curve only'),
+ ('Other', 'Other', 'Insert points into other curve only')
+ )
IntersectCurvesAffect = EnumProperty(
- items=intAffectItems,
- name="IntersectCurvesAffect",
- description="Determines which of the selected curves will be affected by the operation",
- default='Both'
- )
+ items=intAffectItems,
+ name="IntersectCurvesAffect",
+ description="Determines which of the selected curves will be affected by the operation",
+ default='Both'
+ )
-class CurvePanel(bpy.types.Panel):
+class CurvePanel(Panel):
bl_label = "Curve Tools 2"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
@@ -168,7 +177,8 @@ class CurvePanel(bpy.types.Panel):
@classmethod
def poll(cls, context):
if len(context.selected_objects) > 0:
- return (context.active_object.type == "CURVE")
+ obj = context.active_object
+ return (obj and obj.type == "CURVE")
def draw(self, context):
scene = context.scene
@@ -179,7 +189,6 @@ class CurvePanel(bpy.types.Panel):
UTILSDROP = scene.UTUtilsDrop
layout = self.layout
-
# Z. selection
boxSelection = self.layout.box()
row = boxSelection.row(align=True)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list