mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
Added tag functionality
This commit is contained in:
parent
6ebb4f23d0
commit
0a816d9092
@ -46,6 +46,14 @@ class DirectNodePath(NodePath):
|
||||
class SelectedNodePaths(PandaObject):
|
||||
def __init__(self):
|
||||
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):
|
||||
self.selectedDict = {}
|
||||
@ -62,6 +70,12 @@ class SelectedNodePaths(PandaObject):
|
||||
# Reset selected objects and highlight if multiSelect is false
|
||||
if not fMultiSelect:
|
||||
self.deselectAll()
|
||||
|
||||
# Select tagged object if present
|
||||
for tag in self.tagList:
|
||||
if nodePath.hasNetTag(tag):
|
||||
nodePath = nodePath.findNetTag(tag)
|
||||
break
|
||||
|
||||
# Get this pointer
|
||||
id = nodePath.id()
|
||||
|
@ -8,13 +8,8 @@ def ROUND_TO(value, divisor):
|
||||
def ROUND_INT(val):
|
||||
return int(round(val))
|
||||
|
||||
def CLAMP(val, min, max):
|
||||
if val < min:
|
||||
return min
|
||||
elif val > max:
|
||||
return max
|
||||
else:
|
||||
return val
|
||||
def CLAMP(val, minVal, maxVal):
|
||||
return min(max(val, minVal), maxVal)
|
||||
|
||||
# Create a tk compatible color string
|
||||
def getTkColorString(color):
|
||||
|
Loading…
x
Reference in New Issue
Block a user