Skip to content

Commit 88cd876

Browse files
committed
scene session settings
1 parent 1e86fc0 commit 88cd876

File tree

7 files changed

+24
-43
lines changed

7 files changed

+24
-43
lines changed

plugin/RV_scene_clear.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
import rhinoscriptsyntax as rs # type: ignore
76

87
from compas_rv.session import RVSession

plugin/RV_scene_redraw.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
import rhinoscriptsyntax as rs # type: ignore
76

87
from compas_rv.session import RVSession

plugin/RV_session_open.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
from compas_rui.forms import FileForm
76
from compas_rv.session import RVSession
87

plugin/RV_session_redo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
from compas_rv.session import RVSession
76

87

plugin/RV_session_save.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
from compas_rui.forms import FileForm
76
from compas_rv.session import RVSession
87

plugin/RV_session_undo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# venv: rhinovault
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

5-
65
from compas_rv.session import RVSession
76

87

plugin/RV_settings.py

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,52 @@
33
# r: compas>=2.5, compas_rui>=0.3.1, compas_session>=0.4.1, compas_tna>=0.5
44

55
import rhinoscriptsyntax as rs # type: ignore
6+
from pydantic import BaseModel
67

78
from compas_rui.forms import NamedValuesForm
89
from compas_rv.session import RVSession
910

11+
# Switch to using ModelFieldsForm
12+
1013

1114
def update_settings(model, title):
12-
names = [name for name, info in model.model_fields.items()]
13-
values = [getattr(model, name) for name in names]
15+
names = []
16+
values = []
17+
for name, info in model.model_fields.items():
18+
if issubclass(info.annotation, BaseModel):
19+
continue
20+
names.append(name)
21+
values.append(getattr(model, name))
1422
form = NamedValuesForm(names, values, title=title)
1523
if form.show():
1624
for name, value in form.attributes.items():
1725
setattr(model, name, value)
1826

1927

28+
# =============================================================================
29+
# Command
30+
# =============================================================================
31+
32+
2033
def RunCommand():
2134
session = RVSession()
2235

23-
options1 = ["TNA", "Drawing"]
24-
option1 = rs.GetString(message="Settings Section", strings=options1)
25-
if not option1:
36+
options = ["RhinoVAULT", "TNA", "Drawing"]
37+
option = rs.GetString(message="Settings Section", strings=options)
38+
if not option:
2639
return
2740

28-
if option1 == "TNA":
29-
options2 = ["Horizontal", "Vertical"]
30-
option2 = rs.GetString(message="Settings Section", strings=options2)
31-
if not option2:
32-
return
33-
34-
title = f"{option1} {option2}"
41+
if option == "RhinoVAULT":
42+
update_settings(session.settings, title=option)
3543

36-
if option2 == "Horizontal":
37-
update_settings(session.settings.tna.horizontal, title=title)
44+
elif option == "TNA":
45+
update_settings(session.settings.tna, title=option)
3846

39-
elif option2 == "Vertical":
40-
update_settings(session.settings.tna.vertical, title=title)
41-
42-
elif option1 == "Drawing":
43-
options2 = ["FormDiagram", "ForceDiagram", "ThrustDiagram"]
44-
option2 = rs.GetString(message="Settings Section", strings=options2)
45-
if not option2:
46-
return
47-
48-
title = f"{option1} {option2}"
49-
50-
if option2 == "FormDiagram":
51-
pass
52-
53-
elif option2 == "ForceDiagram":
54-
pass
55-
56-
elif option2 == "ThrustDiagram":
57-
update_settings(session.settings.drawing.thrust, title=title)
47+
elif option == "Drawing":
48+
update_settings(session.settings.drawing, title=option)
5849

5950
session.scene.redraw()
6051

61-
# =============================================================================
62-
# Save session
63-
# =============================================================================
64-
6552
if session.settings.autosave:
6653
session.record(name="Update settings")
6754

0 commit comments

Comments
 (0)