23 from PyQt5
import QtCore, QtWidgets
24 from .render_mode_widget
import RenderModeWidget
29 RenderModeWidget.__init__(self, parent)
32 self.
text_ =
"Helix & Strand Cartoon"
39 max_spline_detail = 20
62 poly_mode_label = QtWidgets.QLabel(
"Poly Mode")
65 self.poly_mode_cb_.addItem(
"Points")
66 self.poly_mode_cb_.addItem(
"Wireframe")
67 self.poly_mode_cb_.addItem(
"Surface")
70 spline_label = QtWidgets.QLabel(
"Spline Detail")
73 self.spline_spinbox_.setRange(min_spline_detail, max_spline_detail)
76 arc_label = QtWidgets.QLabel(
"Arc Detail")
79 self.arc_spinbox_.setRange(min_arc_detail, max_arc_detail)
82 tube_label = QtWidgets.QLabel(
"Tube")
83 font = tube_label.font()
87 radius_tube_label = QtWidgets.QLabel(
"Radius")
90 self.width_tube_spinbox_.setRange(min_width, max_tube_width)
91 self.width_tube_spinbox_.setDecimals(1)
92 self.width_tube_spinbox_.setSingleStep(0.1)
95 self.width_tube_slider_.setRange(int(min_width*10.0), int(max_tube_width*10.0))
96 self.width_tube_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
97 self.width_tube_slider_.setTickInterval(1)
100 ratio_tube_label = QtWidgets.QLabel(
"Ratio")
103 self.thickness_tube_spinbox_.setRange(min_tube_ratio, max_tube_ratio)
104 self.thickness_tube_spinbox_.setDecimals(1)
105 self.thickness_tube_spinbox_.setSingleStep(0.1)
108 self.thickness_tube_slider_.setRange(int(min_tube_ratio*10.0), int(max_tube_ratio*10))
109 self.thickness_tube_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
110 self.thickness_tube_slider_.setTickInterval(1)
113 tube_profile_label = QtWidgets.QLabel(
"Tube Profile Type")
115 self.tube_profile_spinbox_.setRange(min_profile, max_profile)
118 helix_label = QtWidgets.QLabel(
"Helix")
119 font = helix_label.font()
123 radius_helix_label = QtWidgets.QLabel(
"Width")
126 self.width_helix_spinbox_.setRange(min_width, max_width)
127 self.width_helix_spinbox_.setDecimals(1)
128 self.width_helix_spinbox_.setSingleStep(0.1)
131 self.width_helix_slider_.setRange(int(min_width*10.0), int(max_width*10.0))
132 self.width_helix_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
133 self.width_helix_slider_.setTickInterval(1)
136 ratio_helix_label = QtWidgets.QLabel(
"Thickness")
139 self.thickness_helix_spinbox_.setRange(min_ratio,max_ratio)
140 self.thickness_helix_spinbox_.setDecimals(1)
141 self.thickness_helix_spinbox_.setSingleStep(0.1)
144 self.thickness_helix_slider_.setRange(int(min_ratio*10.0), int(max_ratio*10.0))
145 self.thickness_helix_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
146 self.thickness_helix_slider_.setTickInterval(1)
149 ecc_helix_label = QtWidgets.QLabel(
"ECC")
152 self.ecc_helix_spinbox_.setRange(min_ecc,max_ecc)
153 self.ecc_helix_spinbox_.setDecimals(1)
154 self.ecc_helix_spinbox_.setSingleStep(0.1)
157 self.ecc_helix_slider_.setRange(int(min_ecc*10), int(max_ecc*10))
158 self.ecc_helix_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
159 self.ecc_helix_slider_.setTickInterval(1)
162 helix_profile_label = QtWidgets.QLabel(
"Helix Profile Type")
164 self.helix_profile_spinbox_.setRange(min_profile, max_profile)
167 helix_mode_label = QtWidgets.QLabel(
"Helix Render Mode")
169 self.helix_mode_spinbox_.setRange(0, 1)
172 strand_label = QtWidgets.QLabel(
"Strand")
173 font = strand_label.font()
177 radius_strand_label = QtWidgets.QLabel(
"Width")
180 self.width_strand_spinbox_.setRange(min_width, max_width)
181 self.width_strand_spinbox_.setDecimals(1)
182 self.width_strand_spinbox_.setSingleStep(0.1)
185 self.width_strand_slider_.setRange(int(min_width*10), int(max_width*10))
186 self.width_strand_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
187 self.width_strand_slider_.setTickInterval(1)
190 ratio_strand_label = QtWidgets.QLabel(
"Thickness")
193 self.thickness_strand_spinbox_.setRange(min_ratio,max_ratio)
194 self.thickness_strand_spinbox_.setDecimals(1)
195 self.thickness_strand_spinbox_.setSingleStep(0.1)
198 self.thickness_strand_slider_.setRange(int(min_ratio*10),int(max_ratio*10))
199 self.thickness_strand_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
200 self.thickness_strand_slider_.setTickInterval(1)
203 ecc_strand_label = QtWidgets.QLabel(
"ECC")
206 self.ecc_strand_spinbox_.setRange(min_ecc,max_ecc)
207 self.ecc_strand_spinbox_.setDecimals(1)
208 self.ecc_strand_spinbox_.setSingleStep(0.1)
211 self.ecc_strand_slider_.setRange(int(min_ecc*10), int(max_ecc*10))
212 self.ecc_strand_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
213 self.ecc_strand_slider_.setTickInterval(1)
216 strand_profile_label = QtWidgets.QLabel(
"Strand Profile Type")
218 self.strand_profile_spinbox_.setRange(min_profile, max_profile)
221 strand_mode_label = QtWidgets.QLabel(
"Strand Render Mode")
223 self.strand_mode_spinbox_.setRange(0, 1)
227 grid = QtWidgets.QGridLayout()
228 grid.addWidget(poly_mode_label,row,0,1,1)
231 grid.addWidget(spline_label, row, 0, 1, 3)
234 grid.addWidget(arc_label,row,0,1,3)
237 grid.addWidget(tube_label, row, 0, 1, 3)
239 grid.addWidget(radius_tube_label, row, 0, 1, 1)
243 grid.addWidget(ratio_tube_label, row, 0, 1, 1)
247 grid.addWidget(tube_profile_label, row, 0, 1, 3)
250 grid.addWidget(helix_label, row, 0, 1, 3)
252 grid.addWidget(radius_helix_label, row, 0, 1, 1)
256 grid.addWidget(ratio_helix_label, row, 0, 1, 1)
260 grid.addWidget(ecc_helix_label, row, 0, 1, 1)
264 grid.addWidget(helix_profile_label, row, 0, 1, 3)
267 grid.addWidget(helix_mode_label, row, 0, 1, 3)
270 grid.addWidget(strand_label, row, 0, 1, 3)
272 grid.addWidget(radius_strand_label, row, 0, 1, 1)
276 grid.addWidget(ratio_strand_label, row, 0, 1, 1)
280 grid.addWidget(ecc_strand_label, row, 0, 1, 1)
284 grid.addWidget(strand_profile_label, row, 0, 1, 3)
287 grid.addWidget(strand_mode_label, row, 0, 1, 3)
290 grid.setRowStretch(row+1,1)
295 self.poly_mode_cb_.currentIndexChanged.connect(self.
UpdatePolyMode)
299 self.thickness_tube_spinbox_.valueChanged.connect(self.
UpdateTubeRatio)
321 self.setMinimumSize(250,550)
325 self.poly_mode_cb_.setCurrentIndex(options.GetPolyMode())
326 self.spline_spinbox_.setValue(options.GetSplineDetail())
327 self.arc_spinbox_.setValue(options.GetArcDetail())
331 self.tube_profile_spinbox_.setValue(options.GetTubeProfileType())
335 self.helix_profile_spinbox_.setValue(options.GetHelixProfileType())
336 self.helix_mode_spinbox_.setValue(options.GetHelixMode())
340 self.strand_profile_spinbox_.setValue(options.GetStrandProfileType())
341 self.strand_mode_spinbox_.setValue(options.GetStrandMode())
344 self.GetOptions().SetPolyMode(value)
348 self.GetOptions().SetSplineDetail(value)
352 self.GetOptions().SetArcDetail(value)
356 self.GetOptions().SetTubeRadius(value)
360 self.GetOptions().SetTubeRadius(value/10.0)
364 self.GetOptions().SetTubeRatio(value)
368 self.GetOptions().SetTubeRatio(value/10.0)
372 self.GetOptions().SetTubeProfileType(value)
376 self.GetOptions().SetHelixWidth(value)
380 self.GetOptions().SetHelixWidth(value/10.0)
384 self.GetOptions().SetHelixThickness(value)
388 self.GetOptions().SetHelixThickness(value/10.0)
392 self.GetOptions().SetHelixEcc(value)
396 self.GetOptions().SetHelixProfileType(value)
400 self.GetOptions().SetHelixMode(value)
404 self.GetOptions().SetHelixEcc(value/10.0)
408 self.GetOptions().SetStrandWidth(value)
412 self.GetOptions().SetStrandWidth(value/10.0)
416 self.GetOptions().SetStrandThickness(value)
420 self.GetOptions().SetStrandThickness(value/10.0)
424 self.GetOptions().SetStrandEcc(value)
428 self.GetOptions().SetStrandEcc(value/10.0)
432 self.GetOptions().SetStrandProfileType(value)
436 self.GetOptions().SetStrandMode(value)
440 value = round(value, 2)
441 if(abs(value*10.0 - self.width_tube_slider_.value())>=self.width_tube_slider_.singleStep()):
442 self.width_tube_slider_.setValue(int(value*10.0))
443 if(abs(value - self.width_tube_spinbox_.value())>=self.width_tube_spinbox_.singleStep()):
444 self.width_tube_spinbox_.setValue(value)
447 value = round(value, 2)
448 if(abs(value*10.0 - self.thickness_tube_slider_.value())>=self.thickness_tube_slider_.singleStep()):
449 self.thickness_tube_slider_.setValue(int(value*10.0))
450 if(abs(value - self.thickness_tube_spinbox_.value())>=self.thickness_tube_spinbox_.singleStep()):
451 self.thickness_tube_spinbox_.setValue(value)
454 value = round(value, 2)
455 if(abs(value*10.0 - self.width_helix_slider_.value())>=self.width_helix_slider_.singleStep()):
456 self.width_helix_slider_.setValue(int(value*10.0))
457 if(abs(value - self.width_helix_spinbox_.value())>=self.width_helix_spinbox_.singleStep()):
458 self.width_helix_spinbox_.setValue(value)
461 value = round(value, 2)
462 if(abs(value*10.0 - self.thickness_helix_slider_.value())>=self.thickness_helix_slider_.singleStep()):
463 self.thickness_helix_slider_.setValue(int(value*10.0))
464 if(abs(value - self.thickness_helix_spinbox_.value())>=self.thickness_helix_spinbox_.singleStep()):
465 self.thickness_helix_spinbox_.setValue(value)
468 value = round(value, 2)
469 if(abs(value*10.0 - self.ecc_helix_slider_.value())>=self.ecc_helix_slider_.singleStep()):
470 self.ecc_helix_slider_.setValue(int(value*10.0))
471 if(abs(value - self.ecc_helix_spinbox_.value())>=self.ecc_helix_spinbox_.singleStep()):
472 self.ecc_helix_spinbox_.setValue(value)
475 value = round(value, 2)
476 if(abs(value*10.0 - self.width_strand_slider_.value())>=self.width_strand_slider_.singleStep()):
477 self.width_strand_slider_.setValue(int(value*10.0))
478 if(abs(value - self.width_strand_spinbox_.value())>=self.width_strand_spinbox_.singleStep()):
479 self.width_strand_spinbox_.setValue(value)
482 value = round(value, 2)
483 if(abs(value*10.0 - self.thickness_strand_slider_.value())>=self.thickness_strand_slider_.singleStep()):
484 self.thickness_strand_slider_.setValue(int(value*10.0))
485 if(abs(value - self.thickness_strand_spinbox_.value())>=self.thickness_strand_spinbox_.singleStep()):
486 self.thickness_strand_spinbox_.setValue(value)
489 value = round(value, 2)
490 if(abs(value*10.0 - self.ecc_strand_slider_.value())>=self.ecc_strand_slider_.singleStep()):
491 self.ecc_strand_slider_.setValue(int(value*10.0))
492 if(abs(value - self.ecc_strand_spinbox_.value())>=self.ecc_strand_spinbox_.singleStep()):
493 self.ecc_strand_spinbox_.setValue(value)