def __init__(self): self.sels = [] self.selmasses = {} Component.__init__(self) self.resetValues() self.worldstream = r.getServerConnection() self.usingManipulator = False self.useLocalTransform = False #self.cpp_python_handler = None self.left_button_down = False self.keypressed = False self.editing = False self.editingKeyTrigger = (Qt.Key_M, Qt.ShiftModifier) self.shortcuts = { self.editingKeyTrigger : self.toggleEditingKeyTrigger, (Qt.Key_R, Qt.NoModifier) : self.rotateObject, (Qt.Key_S, Qt.NoModifier) : self.scaleObject, (Qt.Key_G, Qt.NoModifier) : self.translateObject, (Qt.Key_Tab, Qt.NoModifier) : self.cycleManipulator, (Qt.Key_Z, Qt.ControlModifier) : self.undo, (Qt.Key_Delete, Qt.NoModifier) : self.deleteObject, (Qt.Key_L, Qt.AltModifier) : self.linkObjects, (Qt.Key_L, Qt.ControlModifier|Qt.ShiftModifier) : self.unlinkObjects, } # Connect to key pressed signal from input context self.edit_inputcontext = naali.createInputContext("object-edit", 100) self.edit_inputcontext.SetTakeMouseEventsOverQt(True) #print "connecting to",self.edit_inputcontext self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed) # Connect to mouse events self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll) self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed) self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased) self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove) self.resetManipulators() self.selection_rect = QRect() self.selection_rect_startpos = None r.c = self #this is for using objectedit from command.py self.selection_box_entity = None self.selection_box = None self.selection_box_inited = False self.menuToggleAction = None mainWindow = naali.ui.MainWindow() print mainWindow if mainWindow: menuBar = mainWindow.menuBar() self.menuToggleAction = menuBar.addAction("Manipulation Toggle") self.menuToggleAction.connect("triggered()", self.toggleEditingKeyTrigger) self.toggleEditing(False) """
def __init__(self): self.sels = [] Component.__init__(self) self.window = window.ObjectEditWindow(self) self.resetValues() self.worldstream = r.getServerConnection() self.usingManipulator = False self.useLocalTransform = False self.cpp_python_handler = None self.left_button_down = False self.keypressed = False self.shortcuts = { (Qt.Key_Z, Qt.ControlModifier) : self.undo, (Qt.Key_Delete, Qt.NoModifier) : self.deleteObject, (Qt.Key_L, Qt.AltModifier) : self.linkObjects, (Qt.Key_L, Qt.ControlModifier|Qt.ShiftModifier) : self.unlinkObjects, } # Connect to key pressed signal from input context self.edit_inputcontext = naali.createInputContext("object-edit", 100) self.edit_inputcontext.SetTakeMouseEventsOverQt(True) self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed) # Connect to mouse events self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll) self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed) self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased) self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove) self.resetManipulators() loader = QUiLoader() selectionfile = QFile(self.SELECTIONRECT) self.selection_rect = loader.load(selectionfile) #rectprops = r.createUiWidgetProperty(2) #~ print type(rectprops), dir(rectprops) #print rectprops.WidgetType #uiprops.widget_name_ = "Selection Rect" #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it proxy = r.createUiProxyWidget(self.selection_rect) uism = r.getUiSceneManager() uism.AddWidgetToScene(proxy) proxy.setWindowFlags(0) #changing it to Qt::Widget self.selection_rect.setGeometry(0,0,0,0) self.selection_rect_startpos = None r.c = self #this is for using objectedit from command.py # Get world building modules python handler self.cpp_python_handler = r.getQWorldBuildingHandler() if self.cpp_python_handler == None: r.logDebug("Could not aqquire world building service to object edit") else: # Connect signals self.cpp_python_handler.connect('ActivateEditing(bool)', self.on_activate_editing) self.cpp_python_handler.connect('ManipulationMode(int)', self.on_manupulation_mode_change) self.cpp_python_handler.connect('RemoveHightlight()', self.deselect_all) self.cpp_python_handler.connect('RotateValuesToNetwork(int, int, int)', self.changerot_cpp) self.cpp_python_handler.connect('ScaleValuesToNetwork(double, double, double)', self.changescale_cpp) self.cpp_python_handler.connect('PosValuesToNetwork(double, double, double)', self.changepos_cpp) self.cpp_python_handler.connect('CreateObject()', self.createObject) self.cpp_python_handler.connect('DuplicateObject()', self.duplicate) self.cpp_python_handler.connect('DeleteObject()', self.deleteObject) # Pass widgets self.cpp_python_handler.PassWidget("Mesh", self.window.mesh_widget) self.cpp_python_handler.PassWidget("Animation", self.window.animation_widget) self.cpp_python_handler.PassWidget("Sound", self.window.sound_widget) self.cpp_python_handler.PassWidget("Materials", self.window.materialTabFormWidget) # Check if build mode is active, required on python restarts self.on_activate_editing(self.cpp_python_handler.IsBuildingActive())
def __init__(self): self.sels = [] Component.__init__(self) self.window = window.ObjectEditWindow(self) self.resetValues() self.worldstream = r.getServerConnection() self.usingManipulator = False self.useLocalTransform = False self.cpp_python_handler = None self.left_button_down = False self.keypressed = False self.shortcuts = { (Qt.Key_Z, Qt.ControlModifier): self.undo, (Qt.Key_Delete, Qt.NoModifier): self.deleteObject, (Qt.Key_L, Qt.AltModifier): self.linkObjects, (Qt.Key_L, Qt.ControlModifier | Qt.ShiftModifier): self.unlinkObjects, } # Connect to key pressed signal from input context self.edit_inputcontext = naali.createInputContext("object-edit", 100) self.edit_inputcontext.SetTakeMouseEventsOverQt(True) self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed) # Connect to mouse events self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll) self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed) self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased) self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove) self.resetManipulators() loader = QUiLoader() selectionfile = QFile(self.SELECTIONRECT) self.selection_rect = loader.load(selectionfile) #rectprops = r.createUiWidgetProperty(2) #~ print type(rectprops), dir(rectprops) #print rectprops.WidgetType #uiprops.widget_name_ = "Selection Rect" #uiprops.my_size_ = QSize(width, height) #not needed anymore, uimodule reads it proxy = r.createUiProxyWidget(self.selection_rect) uism = naali.ui uism.AddWidgetToScene(proxy) proxy.setWindowFlags(0) #changing it to Qt::Widget self.selection_rect.setGeometry(0, 0, 0, 0) self.selection_rect_startpos = None r.c = self #this is for using objectedit from command.py # Get world building modules python handler self.cpp_python_handler = r.getQWorldBuildingHandler() if self.cpp_python_handler == None: r.logDebug( "Could not aqquire world building service to object edit") else: # Connect signals self.cpp_python_handler.connect('ActivateEditing(bool)', self.on_activate_editing) self.cpp_python_handler.connect('ManipulationMode(int)', self.on_manupulation_mode_change) self.cpp_python_handler.connect('RemoveHightlight()', self.deselect_all) self.cpp_python_handler.connect( 'RotateValuesToNetwork(int, int, int)', self.changerot_cpp) self.cpp_python_handler.connect( 'ScaleValuesToNetwork(double, double, double)', self.changescale_cpp) self.cpp_python_handler.connect( 'PosValuesToNetwork(double, double, double)', self.changepos_cpp) self.cpp_python_handler.connect('CreateObject()', self.createObject) self.cpp_python_handler.connect('DuplicateObject()', self.duplicate) self.cpp_python_handler.connect('DeleteObject()', self.deleteObject) # Pass widgets self.cpp_python_handler.PassWidget("Mesh", self.window.mesh_widget) self.cpp_python_handler.PassWidget("Animation", self.window.animation_widget) self.cpp_python_handler.PassWidget("Sound", self.window.sound_widget) self.cpp_python_handler.PassWidget( "Materials", self.window.materialTabFormWidget) # Check if build mode is active, required on python restarts self.on_activate_editing( self.cpp_python_handler.IsBuildingActive())
def __init__(self): self.sels = [] self.selmasses = {} Component.__init__(self) self.resetValues() self.worldstream = r.getServerConnection() self.usingManipulator = False self.useLocalTransform = False #self.cpp_python_handler = None self.left_button_down = False self.keypressed = False self.editing = False self.editingKeyTrigger = (Qt.Key_M, Qt.ShiftModifier) self.shortcuts = { self.editingKeyTrigger: self.toggleEditingKeyTrigger, (Qt.Key_R, Qt.NoModifier): self.rotateObject, (Qt.Key_S, Qt.NoModifier): self.scaleObject, (Qt.Key_G, Qt.NoModifier): self.translateObject, (Qt.Key_Tab, Qt.NoModifier): self.cycleManipulator, (Qt.Key_Z, Qt.ControlModifier): self.undo, (Qt.Key_Delete, Qt.NoModifier): self.deleteObject, (Qt.Key_L, Qt.AltModifier): self.linkObjects, (Qt.Key_L, Qt.ControlModifier | Qt.ShiftModifier): self.unlinkObjects, } # Connect to key pressed signal from input context self.edit_inputcontext = naali.createInputContext("object-edit", 100) self.edit_inputcontext.SetTakeMouseEventsOverQt(True) #print "connecting to",self.edit_inputcontext self.edit_inputcontext.connect('KeyPressed(KeyEvent*)', self.on_keypressed) # Connect to mouse events self.edit_inputcontext.connect('MouseScroll(MouseEvent*)', self.on_mousescroll) self.edit_inputcontext.connect('MouseLeftPressed(MouseEvent*)', self.on_mouseleftpressed) self.edit_inputcontext.connect('MouseLeftReleased(MouseEvent*)', self.on_mouseleftreleased) self.edit_inputcontext.connect('MouseMove(MouseEvent*)', self.on_mousemove) self.resetManipulators() self.selection_rect = QRect() self.selection_rect_startpos = None r.c = self #this is for using objectedit from command.py self.selection_box_entity = None self.selection_box = None self.selection_box_inited = False self.menuToggleAction = None mainWindow = naali.ui.MainWindow() print mainWindow if mainWindow: menuBar = mainWindow.menuBar() self.menuToggleAction = menuBar.addAction("Manipulation Toggle") self.menuToggleAction.connect("triggered()", self.toggleEditingKeyTrigger) self.toggleEditing(False) """