
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This code shows my ramp parameter, but if I uncomment out the show line at the end and comment out the "self.w.show()" inside the class definition I get an empty box without the ramp. Basically, can create a ramp parameter but not get it "out" from the class defenition. Is there something wrong with how I define the window?
from PySide.QtCore import *
from PySide.QtGui import *
from maya.app.general.mayaMixin import MayaQWidgetBaseMixin
import pymel.core as pm
from maya import cmds
from maya import OpenMayaUI as omui
import shiboken
class dice_objectScatter(MayaQWidgetBaseMixin, QTreeView):
def __init__(self, parent=None, *args, **kwargs):
super(dice_objectScatter, self).__init__(*args, **kwargs)
# Destroy this widget when closed. Otherwise it will stay around
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.setupUi()
def setupUi(self):
self.setObjectName("Form")
self.resize(400, 400)
self.setWindowTitle("ramp test")
self.verticalLayout = QVBoxLayout(self)
self.setLayout(self.verticalLayout)
self.verticalLayout.setObjectName("mainLayout")
layout = omui.MQtUtil.fullName(long(shiboken.getCppPointer(self.verticalLayout)[0])) # get maya pointer
cmds.setParent(layout)
self.w = QWidget()
rampWidgetName = "rampWidget3"
self.w.setObjectName(rampWidgetName)
self.l = QVBoxLayout(self.w)
self.l.setObjectName("ramp_layout")
self.w_ptr = omui.MQtUtil.findWindow(rampWidgetName)
self.w_name = omui.MQtUtil.fullName(long(self.w_ptr))
cmds.setParent(self.w_name)
self.ramp_eval_string = 'source AEaddRampControl; AEmakeLargeRamp("|rampTest1.houdiniAssetParm_ramp__ramp", 0, 0, 0, 0, 0);'
mel.eval(self.ramp_eval_string)
self.w.show()
ptr = omui.MQtUtil.mainWindow()
mainWin = shiboken.wrapInstance(long(ptr), QWidget)
window = dice_objectScatter()
#window.show()
Solved! Go to Solution.