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
5009787d
Commit
5009787d
authored
11 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
minor tweak to printing tools, report which axis is clamped.
parent
90c30944
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
object_print3d_utils/operators.py
+15
-9
15 additions, 9 deletions
object_print3d_utils/operators.py
with
15 additions
and
9 deletions
object_print3d_utils/operators.py
+
15
−
9
View file @
5009787d
...
...
@@ -489,14 +489,14 @@ class Print3DSelectReport(Operator):
# -----------
# Scale to...
def
_scale
(
scale
,
report
=
None
):
def
_scale
(
scale
,
report
=
None
,
report_suffix
=
""
):
if
scale
!=
1.0
:
bpy
.
ops
.
transform
.
resize
(
value
=
(
scale
,)
*
3
,
mirror
=
False
,
proportional
=
'
DISABLED
'
,
snap
=
False
,
texture_space
=
False
)
if
report
is
not
None
:
report
({
'
INFO
'
},
"
Scaled by %s
"
%
clean_float
(
"
%.6f
"
%
scale
))
report
({
'
INFO
'
},
"
Scaled by
%s
%s
"
%
(
clean_float
(
"
%.6f
"
%
scale
)
,
report_suffix
)
)
class
Print3DScaleToVolume
(
Operator
):
...
...
@@ -550,6 +550,9 @@ class Print3DScaleToBounds(Operator):
length_init
=
FloatProperty
(
options
=
{
'
HIDDEN
'
},
)
axis_init
=
IntProperty
(
options
=
{
'
HIDDEN
'
},
)
length
=
FloatProperty
(
name
=
"
Length Limit
"
,
unit
=
'
LENGTH
'
,
...
...
@@ -558,24 +561,27 @@ class Print3DScaleToBounds(Operator):
def
execute
(
self
,
context
):
scale
=
self
.
length
/
self
.
length_init
_scale
(
scale
,
self
.
report
)
_scale
(
scale
,
report
=
self
.
report
,
report_suffix
=
"
, Clamping %s-Axis
"
%
"
XYZ
"
[
self
.
axis_init
])
return
{
'
FINISHED
'
}
def
invoke
(
self
,
context
,
event
):
from
mathutils
import
Vector
def
calc_length
(
vecs
):
return
max
((
max
(
v
[
i
]
for
v
in
vecs
)
-
min
(
v
[
i
]
for
v
in
vecs
))
for
i
in
range
(
3
))
return
max
((
(
max
(
v
[
i
]
for
v
in
vecs
)
-
min
(
v
[
i
]
for
v
in
vecs
))
,
i
)
for
i
in
range
(
3
))
if
context
.
mode
==
'
EDIT_MESH
'
:
length
=
calc_length
([
Vector
(
v
)
*
obj
.
matrix_world
for
v
in
context
.
edit_object
.
bound_box
])
length
,
axis
=
calc_length
([
Vector
(
v
)
*
obj
.
matrix_world
for
v
in
context
.
edit_object
.
bound_box
])
else
:
length
=
calc_length
([
Vector
(
v
)
*
obj
.
matrix_world
for
obj
in
context
.
selected_editable_objects
if
obj
.
type
==
'
MESH
'
for
v
in
obj
.
bound_box
])
length
,
axis
=
calc_length
([
Vector
(
v
)
*
obj
.
matrix_world
for
obj
in
context
.
selected_editable_objects
if
obj
.
type
==
'
MESH
'
for
v
in
obj
.
bound_box
])
self
.
length_init
=
self
.
length
=
length
self
.
axis_init
=
axis
wm
=
context
.
window_manager
return
wm
.
invoke_props_dialog
(
self
)
...
...
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