Commit 52917436 authored by sumpfralle's avatar sumpfralle

added "view items" buttons to the 3D view

added wiki link for http://sourceforge.net/apps/mediawiki/pycam/index.php?title=3D_View


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@894 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 0565f3c2
...@@ -11,6 +11,7 @@ Version 0.4.1 - UNRELEASED ...@@ -11,6 +11,7 @@ Version 0.4.1 - UNRELEASED
* unify DropCutter behaviour for models that are higher than the defined bounding box * unify DropCutter behaviour for models that are higher than the defined bounding box
* always move up to safety height in this case * always move up to safety height in this case
* optional visualization of toolpath direction * optional visualization of toolpath direction
* visibility of 3D view items is now configurable in the 3D window
Version 0.4.0.1 - 2010-10-24 Version 0.4.0.1 - 2010-10-24
* disabled parallel processing for Windows standalone executable * disabled parallel processing for Windows standalone executable
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<menuitem action="HelpModelTransformations"/> <menuitem action="HelpModelTransformations"/>
<menuitem action="HelpGCodeExport"/> <menuitem action="HelpGCodeExport"/>
<menuitem action="HelpSimulation"/> <menuitem action="HelpSimulation"/>
<menuitem action="Help3DView"/>
<menuitem action="HelpServerMode"/> <menuitem action="HelpServerMode"/>
<menuitem action="HelpCommandLine"/> <menuitem action="HelpCommandLine"/>
<menuitem action="HelpHotkeys"/> <menuitem action="HelpHotkeys"/>
......
...@@ -4441,13 +4441,39 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -4441,13 +4441,39 @@ This feature requires the Open Dynamics Engine (ODE).</property>
<object class="GtkWindow" id="view3dwindow"> <object class="GtkWindow" id="view3dwindow">
<property name="title" translatable="yes">PyCAM Visualization</property> <property name="title" translatable="yes">PyCAM Visualization</property>
<child> <child>
<object class="GtkVBox" id="view3d_window"> <object class="GtkVBox" id="view3dbox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">1</property>
<child>
<object class="GtkHBox" id="ViewControls">
<property name="visible">True</property>
<property name="spacing">4</property>
<child> <child>
<object class="GtkToolbar" id="View Controls"> <object class="GtkToolbar" id="ViewItems">
<property name="visible">True</property> <property name="visible">True</property>
<property name="toolbar_style">both</property> <property name="tooltip_text" translatable="yes">Configure the list of visible items.</property>
<property name="toolbar_style">text</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVSeparator" id="vseparator13">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="PerspectiveControls">
<property name="visible">True</property>
<property name="toolbar_style">text</property>
<child> <child>
<object class="GtkToolButton" id="Reset View"> <object class="GtkToolButton" id="Reset View">
<property name="visible">True</property> <property name="visible">True</property>
...@@ -4526,6 +4552,11 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -4526,6 +4552,11 @@ This feature requires the Open Dynamics Engine (ODE).</property>
</packing> </packing>
</child> </child>
</object> </object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="position">0</property> <property name="position">0</property>
...@@ -4655,84 +4686,10 @@ This feature requires the Open Dynamics Engine (ODE).</property> ...@@ -4655,84 +4686,10 @@ This feature requires the Open Dynamics Engine (ODE).</property>
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkHBox" id="view3dbox">
<property name="visible">True</property>
<child>
<object class="GtkToolbar" id="ViewItemsSelection">
<property name="sensitive">False</property>
<property name="orientation">vertical</property>
<property name="toolbar_style">both</property>
<child>
<object class="GtkToggleToolButton" id="ToggleModelView">
<property name="visible">True</property>
<property name="label" translatable="yes">Model</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton" id="ToggleToolpathView">
<property name="visible">True</property>
<property name="label" translatable="yes">Toolpath</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton" id="ToggleBoundingBoxView">
<property name="visible">True</property>
<property name="label" translatable="yes">Bounds</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton" id="ToggleAxesView">
<property name="visible">True</property>
<property name="label" translatable="yes">Axes</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton" id="ToggleDrillProgressView">
<property name="visible">True</property>
<property name="label" translatable="yes">Drill</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">True</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child> <child>
<placeholder/> <placeholder/>
</child> </child>
</object> </object>
<packing>
<property name="position">2</property>
</packing>
</child>
</object>
</child> </child>
</object> </object>
<object class="GtkAdjustment" id="min-x"> <object class="GtkAdjustment" id="min-x">
...@@ -5306,7 +5263,7 @@ ODE can't be used in combination with parallel processing or server mode.</prope ...@@ -5306,7 +5263,7 @@ ODE can't be used in combination with parallel processing or server mode.</prope
<property name="visible">True</property> <property name="visible">True</property>
<property name="left_padding">12</property> <property name="left_padding">12</property>
<child> <child>
<object class="GtkVBox" id="vbox13"> <object class="GtkVBox" id="PreferencesVisibleItemsBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">2</property> <property name="spacing">2</property>
...@@ -6819,6 +6776,9 @@ Any selected group of dimensions will be scaled accordingly.</property> ...@@ -6819,6 +6776,9 @@ Any selected group of dimensions will be scaled accordingly.</property>
<object class="GtkAction" id="HelpSimulation"> <object class="GtkAction" id="HelpSimulation">
<property name="label">_Simulation</property> <property name="label">_Simulation</property>
</object> </object>
<object class="GtkAction" id="Help3DView">
<property name="label">3D _View</property>
</object>
<object class="GtkAction" id="HelpCommandLine"> <object class="GtkAction" id="HelpCommandLine">
<property name="label">_Command Line Usage</property> <property name="label">_Command Line Usage</property>
</object> </object>
......
...@@ -35,6 +35,7 @@ import pycam.Geometry.Matrix as Matrix ...@@ -35,6 +35,7 @@ import pycam.Geometry.Matrix as Matrix
from pycam.Geometry.utils import sqrt, number, epsilon from pycam.Geometry.utils import sqrt, number, epsilon
import pycam.Utils.log import pycam.Utils.log
import gtk import gtk
import gobject
import pango import pango
import math import math
import time import time
...@@ -247,7 +248,8 @@ class Camera: ...@@ -247,7 +248,8 @@ class Camera:
class ModelViewWindowGL: class ModelViewWindowGL:
def __init__(self, gui, settings, notify_destroy=None, accel_group=None): def __init__(self, gui, settings, notify_destroy=None, accel_group=None,
item_buttons=None):
# assume, that initialization will fail # assume, that initialization will fail
self.gui = gui self.gui = gui
self.window = self.gui.get_object("view3dwindow") self.window = self.gui.get_object("view3dwindow")
...@@ -320,6 +322,30 @@ class ModelViewWindowGL: ...@@ -320,6 +322,30 @@ class ModelViewWindowGL:
attributes.insert(color) attributes.insert(color)
for name in names: for name in names:
self.gui.get_object(name).set_attributes(attributes) self.gui.get_object(name).set_attributes(attributes)
# add the items buttons (for configuring visible items)
if item_buttons:
items_button_container = self.gui.get_object("ViewItems")
for button in item_buttons:
new_checkbox = gtk.ToggleToolButton()
new_checkbox.set_label(button.get_label())
new_checkbox.set_visible(True)
new_checkbox.set_active(button.get_active())
# Configure the two buttons (in "Preferences" and in the 3D view
# widget) to toggle each other. This is required for a
# consistent view of the setting.
def checkbox_handler(widget, button=button):
button.set_active(not button.get_active())
checkbox_handler_id = new_checkbox.connect_object_after(
"toggled", checkbox_handler, new_checkbox)
def button_handler(widget, new_checkbox=new_checkbox,
checkbox_handler_id=checkbox_handler_id):
new_checkbox.handler_block(checkbox_handler_id)
# prevent any recursive handler-triggering
if new_checkbox.get_active() != widget.get_active():
new_checkbox.set_active(not new_checkbox.get_active())
new_checkbox.handler_unblock(checkbox_handler_id)
button.connect_object_after("toggled", button_handler, button)
items_button_container.insert(new_checkbox, -1)
# show the window # show the window
self.area.show() self.area.show()
self.container.show() self.container.show()
......
...@@ -312,6 +312,7 @@ class ProjectGui: ...@@ -312,6 +312,7 @@ class ProjectGui:
("HelpTaskSetup", self.show_help, "TaskSetup", None), ("HelpTaskSetup", self.show_help, "TaskSetup", None),
("HelpGCodeExport", self.show_help, "GCodeExport", None), ("HelpGCodeExport", self.show_help, "GCodeExport", None),
("HelpSimulation", self.show_help, "Simulation", None), ("HelpSimulation", self.show_help, "Simulation", None),
("Help3DView", self.show_help, "3D_View", None),
("HelpServerMode", self.show_help, "ServerMode", None), ("HelpServerMode", self.show_help, "ServerMode", None),
# TODO: write a general wiki page about the commandline usage (not just examples) # TODO: write a general wiki page about the commandline usage (not just examples)
("HelpCommandLine", self.show_help, "CommandlineExamples", None), ("HelpCommandLine", self.show_help, "CommandlineExamples", None),
...@@ -1946,10 +1947,16 @@ class ProjectGui: ...@@ -1946,10 +1947,16 @@ class ProjectGui:
return return
elif new_state: elif new_state:
if self.view3d is None: if self.view3d is None:
# These buttons are replicated to appear in the 3D view - for
# easier configuration of visible items without the Preferences
# window.
item_buttons = self.gui.get_object(
"PreferencesVisibleItemsBox").get_children()
# do the gl initialization # do the gl initialization
self.view3d = ModelViewWindowGL(self.gui, self.settings, self.view3d = ModelViewWindowGL(self.gui, self.settings,
notify_destroy=self.toggle_3d_view, notify_destroy=self.toggle_3d_view,
accel_group=self._accel_group) accel_group=self._accel_group,
item_buttons=item_buttons)
if self.model and self.view3d.enabled: if self.model and self.view3d.enabled:
self.view3d.reset_view() self.view3d.reset_view()
# disable the "toggle" button, if the 3D view does not work # disable the "toggle" button, if the 3D view does not work
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment