Exemple #1
0
def inside_softimage():
    """Returns a boolean indicating if the code is executed inside softimage."""
    try:
        import maya
        return False
    except ImportError:
        pass
    try:
        from win32com.client import Dispatch as disp
        disp('XSI.Application')
        return True
    except:
        return False
from Qt.QtCore import QObject
from Qt import Signal

from win32com.client import Dispatch as disp
from win32com.client import constants as C
si = disp("XSI.Application")

EVENT_MAPPING = {
    #pyqtsignal : softimage event
    "siActivate": "QtEvents_Activate",
    "siFileExport": "QtEvents_FileExport",
    "siFileImport": "QtEvents_FileImport",
    "siCustomFileExport": "QtEvents_CustomFileExport",
    "siCustomFileImport": "QtEvents_CustomFileImport",
    "siRenderFrame": "QtEvents_RenderFrame",
    "siRenderSequence": "QtEvents_RenderSequence",
    "siRenderAbort": "QtEvents_RenderAbort",
    "siPassChange": "QtEvents_PassChange",
    "siSceneOpen": "QtEvents_SceneOpen",
    "siSceneSaveAs": "QtEvents_SceneSaveAs",
    "siSceneSave": "QtEvents_SceneSave",
    "siChangeProject": "QtEvents_ChangeProject",
    "siConnectShader": "QtEvents_ConnectShader",
    "siDisconnectShader": "QtEvents_DisconnectShader",
    "siCreateShader": "QtEvents_CreateShader",
    "siDragAndDrop": "QtEvents_DragAndDrop",
    "siObjectAdded": "QtEvents_ObjectAdded",
    "siObjectRemoved": "QtEvents_ObjectRemoved",
    "siSelectionChange": "QtEvents_SelectionChange",
    "siSourcePathChange": "QtEvents_SourcePathChange",
    "siValueChange": "QtEvents_ValueChange",
# Add this plug-in path to python path
if __sipath__ not in sys.path:
    sys.path.append(__sipath__)

import Qt

Qt.initialize()

from Qt.QtCore import Qt
from Qt.QtGui import QApplication, QCursor, QKeyEvent

from win32com.client import Dispatch as disp
from win32com.client import constants as C

si = disp("XSI.Application")

# Create a mapping of virtual keys
import win32con

KEY_MAPPING = {
    # key: ( Qt::Key,           ascii,  modifiers )
    8: (Qt.Key_Backspace, "", None),
    9: (Qt.Key_Tab, "\t", None),
    13: (Qt.Key_Enter, "\n", None),
    16: (Qt.Key_Shift, "", None),
    17: (Qt.Key_Control, "", None),
    18: (Qt.Key_Alt, "", None),
    19: (Qt.Key_Pause, "", None),
    20: (Qt.Key_CapsLock, "", None),
    27: (Qt.Key_Escape, "", None),
from PyQt4.QtCore import Qt

from win32com.client import Dispatch as disp
from win32com.client import constants as C
si = disp('XSI.Application')
        
# Create a mapping of virtual keys
import win32con
KEY_MAPPING = {
    # key: ( Qt::Key,           ascii,  modifiers )

      8: ( Qt.Key_Backspace,    '',     None ),
      9: ( Qt.Key_Tab,          '\t',   None ),
     13: ( Qt.Key_Enter,        '\n',   None ),
     16: ( Qt.Key_Shift,        '',     None ),
     17: ( Qt.Key_Control,      '',     None ),
     18: ( Qt.Key_Alt,          '',     None ),
     19: ( Qt.Key_Pause,        '',     None ),
     20: ( Qt.Key_CapsLock,     '',     None ),
     27: ( Qt.Key_Escape,       '',     None ),
     32: ( Qt.Key_Space,        ' ',    None ),
     33: ( Qt.Key_PageUp,       '',     None ),
     34: ( Qt.Key_PageDown,     '',     None ),
     35: ( Qt.Key_End,          '',     None ),
     36: ( Qt.Key_Home,         '',     None ),
     37: ( Qt.Key_Left,         '',     None ),
     38: ( Qt.Key_Up,           '',     None ),
     39: ( Qt.Key_Right,        '',     None ),
     40: ( Qt.Key_Down,         '',     None ),
     44: ( Qt.Key_SysReq,       '',     None ),
     45: ( Qt.Key_Insert,       '',     None ),
Exemple #5
0
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from win32com.client import Dispatch as disp
from win32com.client import constants as C

si = disp('XSI.Application')
log = si.LogMessage
sidesk = si.Desktop
sidict = si.Dictionary
siproj = si.ActiveProject2
sisel = si.Selection
sifact = disp('XSI.Factory')
simath = disp('XSI.Math')
siui = disp('XSI.UIToolkit')
siut = disp('XSI.Utils')