Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Courses
Scotty3D
Commits
82c39405
Commit
82c39405
authored
Mar 15, 2021
by
TheNumbat
Browse files
fix bevel returning nullopt
parent
32c0c330
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/gui/model.cpp
View file @
82c39405
...
...
@@ -404,39 +404,28 @@ void Model::rebuild() {
bool
Model
::
begin_bevel
(
std
::
string
&
err
)
{
auto
sel
=
selected_element
();
if
(
sel
.
has_value
())
{
if
(
std
::
holds_alternative
<
Halfedge_Mesh
::
HalfedgeRef
>
(
*
sel
))
{
return
false
;
}
}
if
(
!
sel
.
has_value
())
return
false
;
my_mesh
->
copy_to
(
old_mesh
);
Halfedge_Mesh
::
FaceRef
new_face
;
std
::
visit
(
overloaded
{[
&
](
Halfedge_Mesh
::
VertexRef
vert
)
{
auto
res
=
my_mesh
->
bevel_vertex
(
vert
);
if
(
res
.
has_value
())
{
new_face
=
*
res
;
beveling
=
Bevel
::
vert
;
}
auto
new_face
=
std
::
visit
(
overloaded
{[
&
](
Halfedge_Mesh
::
VertexRef
vert
)
{
beveling
=
Bevel
::
vert
;
return
my_mesh
->
bevel_vertex
(
vert
);
},
[
&
](
Halfedge_Mesh
::
EdgeRef
edge
)
{
auto
res
=
my_mesh
->
bevel_edge
(
edge
);
if
(
res
.
has_value
())
{
new_face
=
*
res
;
beveling
=
Bevel
::
edge
;
}
beveling
=
Bevel
::
edge
;
return
my_mesh
->
bevel_edge
(
edge
);
},
[
&
](
Halfedge_Mesh
::
FaceRef
face
)
{
auto
res
=
my_mesh
->
bevel_face
(
face
);
if
(
res
.
has_value
())
{
new_face
=
*
res
;
beveling
=
Bevel
::
face
;
}
beveling
=
Bevel
::
face
;
return
my_mesh
->
bevel_face
(
face
);
},
[
&
](
auto
)
{
}},
[
&
](
auto
)
->
std
::
optional
<
Halfedge_Mesh
::
FaceRef
>
{
return
std
::
nullopt
;
}},
*
sel
);
if
(
!
new_face
.
has_value
())
return
false
;
Halfedge_Mesh
::
FaceRef
face
=
new_face
.
value
();
err
=
validate
();
if
(
!
err
.
empty
())
{
...
...
@@ -446,15 +435,15 @@ bool Model::begin_bevel(std::string& err) {
}
else
{
my_mesh
->
render_dirty_flag
=
true
;
set_selected
(
new_
face
);
set_selected
(
face
);
trans_begin
=
{};
auto
h
=
new_
face
->
halfedge
();
trans_begin
.
center
=
new_
face
->
center
();
auto
h
=
face
->
halfedge
();
trans_begin
.
center
=
face
->
center
();
do
{
trans_begin
.
verts
.
push_back
(
h
->
vertex
()
->
pos
);
h
=
h
->
next
();
}
while
(
h
!=
new_
face
->
halfedge
());
}
while
(
h
!=
face
->
halfedge
());
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment