[Maya-Python] Drop indicator and drag pixpam not work after reimplement dragMoveEvent and dragEnterEvent.

2013-01-11 Thread Paul Winex
Hi. Plest help me  in this problem. In treeWidget I reimplement startDrag, 
dragMove and dragEnter. Result: drag indicator and dragPixmap disappeared. Drag 
from another widget or internal drag - does not matter. How to reimplement the 
procedure correctly to make drop indicator and drag pixmap work? 
setDropIndicatorShown(True) not work! 
In the example: Select item0 in treeWidget, drag elements from listWidget to 
treeWidget. LeftMouse press and drag = select, MiddleMouse = Drag.
This code is functional. You can run and test.
Thanks!!!

from PyQt4.QtCore import *
from PyQt4.QtGui import *
#LIST WIDGET
class listWidgetClass(QListWidget):
def __init__(self,  parent = None):
QListWidget.__init__(self)
self.parent = parent
self.setSelectionMode(QAbstractItemView.ExtendedSelection)
#This command does not work
self.setDropIndicatorShown(True)
#
self.setDragEnabled(True)

def mousePressEvent(self, event):
if event.button() == 4:
self.setDragDropMode(QAbstractItemView.DragOnly)
else:
self.setDragDropMode(QAbstractItemView.NoDragDrop)
QListWidget.mousePressEvent(self, event)

def startDrag(self, event):
item = self.selectedItems()
objects = []
if item:
for i in item:
objects.append(str(i.text()))
data = QByteArray()
stream = QDataStream(data, QIODevice.WriteOnly)
stream.writeQString(';'.join(objects))
mimeData = QMimeData()
mimeData.setData('application/x-dropWidget', data)
drag = QDrag(self)
drag.setMimeData(mimeData)
drag.exec_()
#TREE WIDGET
class treeWidgetClass(QTreeWidget):
def __init__(self,  parent = None):
QTreeWidget.__init__(self)
self.parent = parent
self.setSelectionMode(QAbstractItemView.ExtendedSelection)
self.setDragDropMode(QAbstractItemView.InternalMove)
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.header().setVisible(False)
self.setDropIndicatorShown(True)
self.setColumnCount(1)

def addItems(self, objs, dropItem):
if objs:
sourceItem = self.currentItem()
sourceData = 
str(sourceItem.data(0,Qt.UserRole).toString()).split(';')
targetData = str(dropItem.data(0,Qt.UserRole).toString())
if targetData:
targetData = targetData.split(';')
else:
targetData = []
dropData = objs.split(';')

dropItem.setData(0,Qt.UserRole,';'.join(targetData+dropData))
newSourceData = []
for s in sourceData:
if not s in dropData:
newSourceData.append(s)
sourceItem.setData(0,Qt.UserRole,';'.join(newSourceData))

### it is an important part of the code 
##
def dragEnterEvent(self, event):
if event.mimeData().hasFormat('application/x-dropWidget'):
event.accept()
else:
event.ignore()

def dragMoveEvent(self, event):
if event.mimeData().hasFormat('application/x-dropWidget'):
event.accept()
else:
event.ignore()
#

def dropEvent(self, event):
QTreeWidget.dropEvent(self, event)
if event.mimeData().hasFormat('application/x-dropWidget'):
event.accept()
data = event.mimeData().data('application/x-dropWidget')
stream = QDataStream(data, QIODevice.ReadOnly)
text = str(stream.readQString())
if text:
item = self.itemAt(event.pos())
self.addItems(text, item)
self.parent.updateList()

def startDrag(self, dropActions):
data = QByteArray()
stream = QDataStream(data, QIODevice.WriteOnly)
stream.writeQString('')
mimeData = QMimeData()
mimeData.setData('application/x-dropWidget', data)
drag = QDrag(self)
drag.setMimeData(mimeData)
drag.exec_()

def mousePressEvent(self,event):
if  event.button() == 1:
self.setDragDropMode(QAbstractItemView.DropOnly)
QTreeWidget.mousePressEvent(self, event)
elif event.button() == 4:
self.setDragDropMode(QAbstractItemView.InternalMove)
QTreeWidget.mousePressEvent(self, event)

def mouseReleaseEvent(self, event):
self.setDragDropMode(QAbstractItemView.InternalMove)
QTreeWidget.mouseReleaseEvent(self, event)

#MAIN WIDGET
class dropWidget(QMainWindow):
def __init__(self, parent = None):
QMainWindow.__init__(self)
self.resize(516, 282)
self.centralwidget = QWidget(self)
self.horizontalLayout = QHBoxLayout(self.centralwidget)
self.treeWidget = treeWidgetClass(self)

[Maya-Python] Re: Drop indicator and drag pixpam not work after reimplement dragMoveEvent and dragEnterEvent.

2013-01-11 Thread Paul Winex
This problem i have in my plugin http://vimeo.com/56110331

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To post to this group, send email to python_inside_maya@googlegroups.com.
To unsubscribe from this group, send email to 
python_inside_maya+unsubscr...@googlegroups.com.




Re: [Maya-Python] getUV and getUVAtPoint returning wierd results.

2013-01-15 Thread Paul Winex
Use API:

import maya.OpenMaya as om
selection = om.MSelectionList()
om.MGlobal.getActiveSelectionList( selection )
iter = om.MItSelectionList( selection, om.MFn.kMesh )
dagPath = om.MDagPath()
if iter:
while not iter.isDone():
iter.getDagPath( dagPath )
meshFn = om.MFnMesh(dagPath)
#Get UVSets for this mesh
UVSets = []
status = meshFn.getUVSetNames( UVSets )
#Get all UVs for the first UV set.
u = om.MFloatArray()
v = om.MFloatArray()
meshFn.getUVs( u, v, UVSets[0] )
print u
print v
iter.next()

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To post to this group, send email to python_inside_maya@googlegroups.com.
To unsubscribe from this group, send email to 
python_inside_maya+unsubscr...@googlegroups.com.




[Maya-Python] Re: how to drag and drop an icon from pyqt4 gui to maya shelf ?

2013-03-14 Thread Paul Winex
I tried to do it many times in many ways. Maya ignores my drag. If you have a 
working code, please show it! What data should be placed in qdrag?

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Maya-Python] Re: how to drag and drop an icon from pyqt4 gui to maya shelf ?

2013-03-15 Thread Paul Winex
I have created a custom htpershade. I need to assign materials with dnd to 
viewport and textures to the AE.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Maya-Python] Re: copy mesh by points

2013-04-24 Thread Paul Winex
среда, 24 апреля 2013 г., 3:17:49 UTC+4 пользователь vux написал:
 I have one meshData and pointsArray.
 I need copy mesh from meshData by points in pointsArray and have reult 
 meshData with all copied polygons.
 Need fast solution.

http://somesanctus.blogspot.ru
soudce code included

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Maya-Python] Re: copy mesh by points

2013-04-24 Thread Paul Winex
среда, 24 апреля 2013 г., 3:17:49 UTC+4 пользователь vux написал:
 I have one meshData and pointsArray.
 I need copy mesh from meshData by points in pointsArray and have reult 
 meshData with all copied polygons.
 Need fast solution.
Я забыл, ты не любишь читать исходники чужие:)

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Maya-Python] Re: copy mesh by points

2013-04-24 Thread Paul Winex
среда, 24 апреля 2013 г., 3:17:49 UTC+4 пользователь vux написал:
 I have one meshData and pointsArray.
 I need copy mesh from meshData by points in pointsArray and have reult 
 meshData with all copied polygons.
 Need fast solution.

Конечно можешь пересилить себя и попросить исходники, но можно и попросить 
конкретные куски кода у Алексея http://somesanctus.blogspot.ru/ . У меня тоже 
есть подобные штуки но проще.

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Maya-Python] Re: Attach a Maya popupMenu to a QPushButton

2013-06-01 Thread Paul Winex
This is not a solution but maybe help
http://www.djx.com.au/blog/2008/03/13/user-marking-menu-hot-keys/


from PyQt4.QtCore import *
from PyQt4.QtGui import *
from sip import wrapinstance
import maya.OpenMayaUI as omui
import maya.mel as mel
import maya.cmds as cmds

qMayaWindow = wrapinstance(long(omui.MQtUtil.mainWindow()), QObject)
for bb in qMayaWindow.findChildren(QPushButton, 'my_mmButton'):
bb.setParent(None)


class mmButton(QPushButton):
def __init__(self, parent = None):
QPushButton.__init__(self)
self.setObjectName('my_mmButton')
self.setText('MENU')

def mousePressEvent(self, event):
panel = cmds.getPanel(up=1)
if cmds.popupMenu('tempMM', exists=1):
cmds.deleteUI('tempMM')
if not cmds.control(panel , ex=1):
panel = viewPanes
cmds.popupMenu('tempMM', button=1, ctl=0, alt=1, sh=0, 
allowOptionBoxes=1, parent=panel, mm=1) 
cmds.menuItem('menuEditorMenuItem1',
label=Graph Editor,
divider=0,
subMenu=0,
tearOff=0,
command='mel.eval(GraphEditor)',
altModifier=0,
optionModifier=0,
commandModifier=0,
ctrlModifier=0,
shiftModifier=0,
optionBox=0,
enable=1,
data=0,
radialPosition=NW,
allowOptionBoxes=1,
postMenuCommandOnce=0,
enableCommandRepeat=1,
image=menuIconWindow.png,
echoCommand=0,
annotation=Graph Editor,
italicized=0,
boldFont=1)

cmds.menuItem('menuEditorMenuItem3',
label=Hypershade ,
divider=0,
subMenu=0,
tearOff=0,
command='mel.eval(HypershadeWindow)' ,
altModifier=0,
optionModifier=0,
commandModifier=0,
ctrlModifier=0,
shiftModifier=0,
optionBox=0,
enable=1,
data=0,
radialPosition=NE ,
allowOptionBoxes=1,
postMenuCommandOnce=0,
enableCommandRepeat=1,
image=menuIconWindow.png ,
echoCommand=0,
annotation=Hypershade ,
italicized=0,
boldFont=1)

QPushButton.mousePressEvent(self, event)

def mouseReleaseEvent(self, event):
if cmds.popupMenu('tempMM', exists=1):
cmds.deleteUI('tempMM')
QPushButton.mouseReleaseEvent(self, event)

b = mmButton(qMayaWindow)
b.show()

-- 
You received this message because you are subscribed to the Google Groups 
Python Programming for Autodesk Maya group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To post to this group, send email to python_inside_maya@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Maya-Python] MayaPy Cython Import Error

2020-02-01 Thread Paul Winex
I have solution!

1. You need to build cython locally. Install correct VS Libraries. For 
example Maya2018 require VS v14. You need to install Individual component 
and select some C++ build tools v14 and Windows SDK.
2. Install cpython for maya without binary, pip must build it on you local 
machine
Command: 
set LIB=\Maya2018\lib
\Maya2018\bin\mayapy.exe -m pip install cython --no-binary :all:
LIB variable is path to file python27.lib

Now cython is installed, you can try to compile with command from this 
example https://gist.github.com/nrtkbb/5b65d2f5ed42bd9947b5
mayapy.exe setup.py build_ext --inplace


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/53dcbc83-bcd2-4f49-833b-5044d5081cf0%40googlegroups.com.


Re: [Maya-Python] MayaPy Cython Import Error

2020-02-03 Thread Paul Winex
Oh, i forgot one thing.
You need to copy source files form *MayaXXX\include\python2.7* to 
*Maya\Python\include*

суббота, 1 февраля 2020 г., 23:57:24 UTC+3 пользователь Paul Winex написал:
>
> I have solution!
>
> 1. You need to build cython locally. Install correct VS Libraries. For 
> example Maya2018 require VS v14. You need to install Individual component 
> and select some C++ build tools v14 and Windows SDK.
> 2. Install cpython for maya without binary, pip must build it on you local 
> machine
> Command: 
> set LIB=\Maya2018\lib
> \Maya2018\bin\mayapy.exe -m pip install cython --no-binary :all:
> LIB variable is path to file python27.lib
>
> Now cython is installed, you can try to compile with command from this 
> example https://gist.github.com/nrtkbb/5b65d2f5ed42bd9947b5
> mayapy.exe setup.py build_ext --inplace
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/25a7bc0c-d351-461b-96ef-884d85d5ba99%40googlegroups.com.


Re: [Maya-Python] MayaPy Cython Import Error

2020-02-04 Thread Paul Winex
Yes, is alternative)))

понедельник, 3 февраля 2020 г., 22:26:05 UTC+3 пользователь Robert White 
написал:
>
> You don't need to copy the files to a new include folder, instead you want 
> to just make sure the folder is on the `INCLUDE` environment variable.
> So much like you did for LIB, you'd do `set 
> INCLUDE=%INCLUD%;path_to_maya\include\python2.7`
>
>
> On Monday, February 3, 2020 at 3:47:17 AM UTC-6, Paul Winex wrote:
>>
>> Oh, i forgot one thing.
>> You need to copy source files form *MayaXXX\include\python2.7* to 
>> *Maya\Python\include*
>>
>> суббота, 1 февраля 2020 г., 23:57:24 UTC+3 пользователь Paul Winex 
>> написал:
>>>
>>> I have solution!
>>>
>>> 1. You need to build cython locally. Install correct VS Libraries. For 
>>> example Maya2018 require VS v14. You need to install Individual component 
>>> and select some C++ build tools v14 and Windows SDK.
>>> 2. Install cpython for maya without binary, pip must build it on you 
>>> local machine
>>> Command: 
>>> set LIB=\Maya2018\lib
>>> \Maya2018\bin\mayapy.exe -m pip install cython --no-binary :
>>> all:
>>> LIB variable is path to file python27.lib
>>>
>>> Now cython is installed, you can try to compile with command from this 
>>> example https://gist.github.com/nrtkbb/5b65d2f5ed42bd9947b5
>>> mayapy.exe setup.py build_ext --inplace
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/420c5de9-2a85-4a4a-9f19-9d55bb9564db%40googlegroups.com.


Re: [Maya-Python] MayaPy Cython Import Error

2020-02-01 Thread Paul Winex
Hi!
Has anyone been able to compile with cython successfully?
I use Win10, Maya 2019-2020, same problem(

пятница, 18 мая 2018 г., 4:37:13 UTC+3 пользователь Lokesh Kumar написал:
>
> Hi Ruchit,
>
> Even after following all the steps which you have mentioned above, i am 
> still getting the same error.. Can you please help me figure out this thing.
>
>
>
> 
>
> I am using Maya2015 64bit and the mayapy version is " *Python 2.7.3 
> (default, May  8 2013, 09:43:48) [MSC v.1700 64 bit (AMD64)]  "*
>
> *cython was installed successfully *
>
>
> 
>
>
>
>
>
> On Friday, December 1, 2017 at 11:32:40 PM UTC+5:30, Ruchit Bhatt wrote:
>>
>> Using below code i am able to convert *.py to *.pyd. And script editor 
>> are also importing properly. Now tell me how to extract *.egg ? so that i 
>> can use cython without
>> sys.path.append...Will do more test with PyQt/Pyside. I hope it will work 
>> fine. 
>> Thank you
>>
>> import sys
>> sys.path.append("C:\Program 
>> Files\Autodesk\Maya2017\Python\Lib\site-packages\Cython-0.27.3-py2.7-win-amd64.egg"
>> )
>>
>> import cython
>> from distutils.core import setup
>> from distutils.extension import Extension
>> from Cython.Distutils import build_ext
>>
>> setup(
>> cmdclass = {'build_ext': build_ext},
>> ext_modules = [
>> Extension("randomNumber", ["randomNumber.pyx"]),
>> Extension("additionNumber", ["additionNumber.pyx"]),
>> ]
>> )
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/578f1ed9-4039-45fa-812c-112153388199%40googlegroups.com.