Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
c808d3fc
Commit
c808d3fc
authored
14 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
patch [#25632] Get rid of obsolete magic edit property
only for the 3d function surface.
parent
814f0beb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
add_mesh_3d_function_surface.py
+6
-87
6 additions, 87 deletions
add_mesh_3d_function_surface.py
with
6 additions
and
87 deletions
add_mesh_3d_function_surface.py
+
6
−
87
View file @
c808d3fc
...
...
@@ -19,7 +19,7 @@
bl_info
=
{
"
name
"
:
"
3D Function Surfaces
"
,
"
author
"
:
"
Buerbaum Martin (Pontiac)
"
,
"
version
"
:
(
0
,
3
,
6
),
"
version
"
:
(
0
,
3
,
7
),
"
blender
"
:
(
2
,
5
,
6
),
"
api
"
:
34093
,
"
location
"
:
"
View3D > Add > Mesh >
"
\
...
...
@@ -146,16 +146,10 @@ def align_matrix(context):
# verts/edges/faces ... List of vertices/edges/faces for the
# new mesh (as used in from_pydata).
# name ... Name of the new mesh (& object).
# edit ... Replace existing mesh data.
# Note: Using "edit" will destroy/delete existing mesh data.
def
create_mesh_object
(
context
,
verts
,
edges
,
faces
,
name
,
edit
,
align_matrix
):
def
create_mesh_object
(
context
,
verts
,
edges
,
faces
,
name
,
align_matrix
):
scene
=
context
.
scene
obj_act
=
scene
.
objects
.
active
# Can't edit anything, unless we have an active obj.
if
edit
and
not
obj_act
:
return
None
# Create new mesh
mesh
=
bpy
.
data
.
meshes
.
new
(
name
)
...
...
@@ -165,70 +159,8 @@ def create_mesh_object(context, verts, edges, faces, name, edit, align_matrix):
# Update mesh geometry after adding stuff.
mesh
.
update
()
# Deselect all objects.
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
if
edit
:
# Replace geometry of existing object
# Use the active obj and select it.
ob_new
=
obj_act
ob_new
.
select
=
True
if
obj_act
.
mode
==
'
OBJECT
'
:
# Get existing mesh datablock.
old_mesh
=
ob_new
.
data
# Set object data to nothing
ob_new
.
data
=
None
# Clear users of existing mesh datablock.
old_mesh
.
user_clear
()
# Remove old mesh datablock if no users are left.
if
(
old_mesh
.
users
==
0
):
bpy
.
data
.
meshes
.
remove
(
old_mesh
)
# Assign new mesh datablock.
ob_new
.
data
=
mesh
else
:
# Create new object
ob_new
=
bpy
.
data
.
objects
.
new
(
name
,
mesh
)
# Link new object to the given scene and select it.
scene
.
objects
.
link
(
ob_new
)
ob_new
.
select
=
True
# Place the object at the 3D cursor location.
# apply viewRotaion
ob_new
.
matrix_world
=
align_matrix
if
obj_act
and
obj_act
.
mode
==
'
EDIT
'
:
if
not
edit
:
# We are in EditMode, switch to ObjectMode.
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
OBJECT
'
)
# Select the active object as well.
obj_act
.
select
=
True
# Apply location of new object.
scene
.
update
()
# Join new object into the active.
bpy
.
ops
.
object
.
join
()
# Switching back to EditMode.
bpy
.
ops
.
object
.
mode_set
(
mode
=
'
EDIT
'
)
ob_new
=
obj_act
else
:
# We are in ObjectMode.
# Make the new object the active one.
scene
.
objects
.
active
=
ob_new
return
ob_new
import
add_object_utils
add_object_utils
.
object_data_add
(
context
,
mesh
,
operator
=
None
)
# A very simple "bridge" tool.
...
...
@@ -306,12 +238,6 @@ class AddZFunctionSurface(bpy.types.Operator):
bl_label
=
"
Add Z Function Surface
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
# edit - Whether to add or update.
edit
=
BoolProperty
(
name
=
""
,
description
=
""
,
default
=
False
,
options
=
{
'
HIDDEN
'
})
equation
=
StringProperty
(
name
=
"
Z Equation
"
,
description
=
"
Equation for z=f(x,y)
"
,
default
=
"
1 - ( x**2 + y**2 )
"
)
...
...
@@ -342,7 +268,6 @@ class AddZFunctionSurface(bpy.types.Operator):
align_matrix
=
Matrix
()
def
execute
(
self
,
context
):
edit
=
self
.
edit
equation
=
self
.
equation
div_x
=
self
.
div_x
div_y
=
self
.
div_y
...
...
@@ -400,7 +325,7 @@ class AddZFunctionSurface(bpy.types.Operator):
edgeloop_prev
=
edgeloop_cur
obj
=
create_mesh_object
(
context
,
verts
,
[],
faces
,
"
Z Function
"
,
edit
,
self
.
align_matrix
)
"
Z Function
"
,
self
.
align_matrix
)
return
{
'
FINISHED
'
}
...
...
@@ -518,12 +443,6 @@ class AddXYZFunctionSurface(bpy.types.Operator):
bl_label
=
"
Add X,Y,Z Function Surface
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
# edit - Whether to add or update.
edit
=
BoolProperty
(
name
=
""
,
description
=
""
,
default
=
False
,
options
=
{
'
HIDDEN
'
})
x_eq
=
StringProperty
(
name
=
"
X Equation
"
,
description
=
"
Equation for x=f(u,v)
"
,
default
=
"
1.2**v*(sin(u)**2 *sin(v))
"
)
...
...
@@ -601,7 +520,7 @@ class AddXYZFunctionSurface(bpy.types.Operator):
return
{
'
CANCELLED
'
}
obj
=
create_mesh_object
(
context
,
verts
,
[],
faces
,
"
XYZ Function
"
,
self
.
edit
,
self
.
align_matrix
)
"
XYZ Function
"
,
self
.
align_matrix
)
return
{
'
FINISHED
'
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment