mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Added tag functionality
This commit is contained in:
parent
6ebb4f23d0
commit
0a816d9092
@ -46,6 +46,14 @@ class DirectNodePath(NodePath):
|
|||||||
class SelectedNodePaths(PandaObject):
|
class SelectedNodePaths(PandaObject):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset()
|
self.reset()
|
||||||
|
self.tagList = []
|
||||||
|
|
||||||
|
def addTag(self, tag):
|
||||||
|
if tag not in self.tagList:
|
||||||
|
self.tagList.append(tag)
|
||||||
|
|
||||||
|
def removeTag(self, tag):
|
||||||
|
self.tagList.remove(tag)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.selectedDict = {}
|
self.selectedDict = {}
|
||||||
@ -63,6 +71,12 @@ class SelectedNodePaths(PandaObject):
|
|||||||
if not fMultiSelect:
|
if not fMultiSelect:
|
||||||
self.deselectAll()
|
self.deselectAll()
|
||||||
|
|
||||||
|
# Select tagged object if present
|
||||||
|
for tag in self.tagList:
|
||||||
|
if nodePath.hasNetTag(tag):
|
||||||
|
nodePath = nodePath.findNetTag(tag)
|
||||||
|
break
|
||||||
|
|
||||||
# Get this pointer
|
# Get this pointer
|
||||||
id = nodePath.id()
|
id = nodePath.id()
|
||||||
# First see if its already in the selected dictionary
|
# First see if its already in the selected dictionary
|
||||||
|
@ -8,13 +8,8 @@ def ROUND_TO(value, divisor):
|
|||||||
def ROUND_INT(val):
|
def ROUND_INT(val):
|
||||||
return int(round(val))
|
return int(round(val))
|
||||||
|
|
||||||
def CLAMP(val, min, max):
|
def CLAMP(val, minVal, maxVal):
|
||||||
if val < min:
|
return min(max(val, minVal), maxVal)
|
||||||
return min
|
|
||||||
elif val > max:
|
|
||||||
return max
|
|
||||||
else:
|
|
||||||
return val
|
|
||||||
|
|
||||||
# Create a tk compatible color string
|
# Create a tk compatible color string
|
||||||
def getTkColorString(color):
|
def getTkColorString(color):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user