mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Made widget be shown in black when non-movable object selected
This commit is contained in:
parent
37df0df5c7
commit
ff36eb76cb
@ -24,6 +24,7 @@ class DirectManipulationControl(DirectObject):
|
|||||||
self.fWidgetTop = 0
|
self.fWidgetTop = 0
|
||||||
self.fFreeManip = 1
|
self.fFreeManip = 1
|
||||||
self.fScaling = 0
|
self.fScaling = 0
|
||||||
|
self.fMovable = 1
|
||||||
self.mode = None
|
self.mode = None
|
||||||
self.actionEvents = [
|
self.actionEvents = [
|
||||||
['DIRECT-mouse1', self.manipulationStart],
|
['DIRECT-mouse1', self.manipulationStart],
|
||||||
@ -189,14 +190,29 @@ class DirectManipulationControl(DirectObject):
|
|||||||
taskMgr.remove('resizeObjectHandles')
|
taskMgr.remove('resizeObjectHandles')
|
||||||
|
|
||||||
def toggleObjectHandlesMode(self):
|
def toggleObjectHandlesMode(self):
|
||||||
|
if self.fMovable:
|
||||||
self.fSetCoa = 1 - self.fSetCoa
|
self.fSetCoa = 1 - self.fSetCoa
|
||||||
|
|
||||||
|
if self.fSetCoa:
|
||||||
|
self.objectHandles.coaModeColor()
|
||||||
|
else:
|
||||||
|
self.objectHandles.manipModeColor()
|
||||||
|
else:
|
||||||
|
self.objectHandles.disabledModeColor()
|
||||||
|
|
||||||
|
def removeManipulateObjectTask(self):
|
||||||
|
taskMgr.remove('manipulateObject')
|
||||||
|
|
||||||
|
def enableWidgetMove(self):
|
||||||
|
self.fMovable = 1
|
||||||
if self.fSetCoa:
|
if self.fSetCoa:
|
||||||
self.objectHandles.coaModeColor()
|
self.objectHandles.coaModeColor()
|
||||||
else:
|
else:
|
||||||
self.objectHandles.manipModeColor()
|
self.objectHandles.manipModeColor()
|
||||||
|
|
||||||
def removeManipulateObjectTask(self):
|
def disableWidgetMove(self):
|
||||||
taskMgr.remove('manipulateObject')
|
self.fMovable = 0
|
||||||
|
self.objectHandles.disabledModeColor()
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# Function: get edit types list for specified objects which indicate
|
# Function: get edit types list for specified objects which indicate
|
||||||
@ -662,6 +678,9 @@ class ObjectHandles(NodePath, DirectObject):
|
|||||||
def coaModeColor(self):
|
def coaModeColor(self):
|
||||||
self.setColor(.5, .5, .5, 0.5, 1)
|
self.setColor(.5, .5, .5, 0.5, 1)
|
||||||
|
|
||||||
|
def disabledModeColor(self):
|
||||||
|
self.setColor(0.1,0.1,0.1,0.1,1)
|
||||||
|
|
||||||
def manipModeColor(self):
|
def manipModeColor(self):
|
||||||
self.clearColor()
|
self.clearColor()
|
||||||
|
|
||||||
|
@ -520,6 +520,11 @@ class DirectSession(DirectObject):
|
|||||||
'Selected:' + dnp.getName())
|
'Selected:' + dnp.getName())
|
||||||
# Show the manipulation widget
|
# Show the manipulation widget
|
||||||
self.widget.showWidget()
|
self.widget.showWidget()
|
||||||
|
editTypes = self.manipulationControl.getEditTypes([dnp])
|
||||||
|
if (editTypes & EDIT_TYPE_UNEDITABLE == EDIT_TYPE_UNEDITABLE):
|
||||||
|
self.manipulationControl.disableWidgetMove()
|
||||||
|
else:
|
||||||
|
self.manipulationControl.enableWidgetMove()
|
||||||
# Update camera controls coa to this point
|
# Update camera controls coa to this point
|
||||||
# Coa2Camera = Coa2Dnp * Dnp2Camera
|
# Coa2Camera = Coa2Dnp * Dnp2Camera
|
||||||
mCoa2Camera = dnp.mCoa2Dnp * dnp.getMat(self.camera)
|
mCoa2Camera = dnp.mCoa2Dnp * dnp.getMat(self.camera)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user