コード例 #1
0
    def closeEvent(self, evnt):
        """ Makes sure callback/timer is removed when GUI is closed """
        print "m2u: Closing dialog"

        from m2u.max import viewWatcher
        viewWatcher.removeCallback()
        viewWatcher.removeTimer()

        from m2u.max import objectWatcher
        objectWatcher.removeCallback()
        objectWatcher.removeChangeHandler()

        program.setViewFOV("default")

        super(Dialog, self).closeEvent(evnt)
コード例 #2
0
ファイル: __init__.py プロジェクト: zhongming/m2u
def toggleSync(checkbutton):
    """
	Toggles synchronization with UDK on/ff depending on button state.
	"""
    from m2u.max import maxGUI
    from m2u.max import viewWatcher
    from m2u.max import objectWatcher

    if checkbutton.isChecked():  # Sync
        editor = m2u.core.getEditor()
        editor.connectToInstance()  # Editor might change, so keep it general

        if checkbutton.text() == "Sync Interactive":
            viewWatcher.addCallback()  # interactive sync

            # objectWatcher.addCallback()

            viewWatcher.removeTimer()
            maxGUI.guiInstance.ckbToggleSyncTimebased.setChecked(
                False)  # Uncheck other btn
            maxGUI.guiInstance.toggleSpinner(False)

        # HOW TO TIME SYNC ONLY WHEN VIEW HAS CHANGED?
        elif checkbutton.text() == "Sync Timebased":
            from m2u.max import maxGUI
            interval = maxGUI.guiInstance.spnInterval.value()
            viewWatcher.addTimer(interval)  # Timed sync

            viewWatcher.removeCallback()
            maxGUI.guiInstance.ckbToggleSyncInteractive.setChecked(
                False)  # Uncheck other btn

    else:  # Do not sync
        # Make sure stuff is removed
        viewWatcher.removeCallback()
        viewWatcher.removeTimer()

        objectWatcher.removeCallback()
        objectWatcher.removeChangeHandler()
コード例 #3
0
ファイル: __init__.py プロジェクト: m2u/m2u
def toggleSync( checkbutton ):
	"""
	Toggles synchronization with UDK on/ff depending on button state.
	"""
	from m2u.max import maxGUI
	from m2u.max import viewWatcher
	from m2u.max import objectWatcher

	if checkbutton.isChecked():  # Sync
		editor = m2u.core.getEditor()
		editor.connectToInstance()  # Editor might change, so keep it general

		if checkbutton.text() == "Sync Interactive":
			viewWatcher.addCallback() # interactive sync
			
			# objectWatcher.addCallback()

			viewWatcher.removeTimer()  
			maxGUI.guiInstance.ckbToggleSyncTimebased.setChecked(False)  # Uncheck other btn
			maxGUI.guiInstance.toggleSpinner(False)

		# HOW TO TIME SYNC ONLY WHEN VIEW HAS CHANGED?
		elif checkbutton.text() == "Sync Timebased":
			from m2u.max import maxGUI
			interval = maxGUI.guiInstance.spnInterval.value()
			viewWatcher.addTimer(interval)  # Timed sync

			viewWatcher.removeCallback() 
			maxGUI.guiInstance.ckbToggleSyncInteractive.setChecked(False)  # Uncheck other btn

	else:  # Do not sync
		# Make sure stuff is removed
		viewWatcher.removeCallback() 
		viewWatcher.removeTimer() 

		objectWatcher.removeCallback()
		objectWatcher.removeChangeHandler()