mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
Added propertiesMask feature
This commit is contained in:
parent
259b3396a6
commit
33a875a170
@ -27,7 +27,10 @@ class LevelEditorBase(DirectObject):
|
|||||||
self.NPParent = render
|
self.NPParent = render
|
||||||
|
|
||||||
# define your own config file in inherited class
|
# define your own config file in inherited class
|
||||||
self.settingsFile = None
|
self.settingsFile = None
|
||||||
|
|
||||||
|
# you can show/hide specific properties by using propertiesMask and this mode
|
||||||
|
self.mode = BitMask32()
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
""" You should call this in your __init__ method of inherited LevelEditor class """
|
""" You should call this in your __init__ method of inherited LevelEditor class """
|
||||||
|
@ -9,7 +9,7 @@ class ObjectGen:
|
|||||||
class ObjectBase(ObjectGen):
|
class ObjectBase(ObjectGen):
|
||||||
""" Base class for obj definitions """
|
""" Base class for obj definitions """
|
||||||
def __init__(self, name='', createFunction = None, model = None, models= [], anims = [], animNames = [], properties={},
|
def __init__(self, name='', createFunction = None, model = None, models= [], anims = [], animNames = [], properties={},
|
||||||
movable = True, actor = False, named=False, orderedProperties=[]):
|
movable = True, actor = False, named=False, orderedProperties=[], propertiesMask={}):
|
||||||
ObjectGen.__init__(self, name)
|
ObjectGen.__init__(self, name)
|
||||||
self.createFunction = createFunction
|
self.createFunction = createFunction
|
||||||
self.model = model
|
self.model = model
|
||||||
@ -20,7 +20,10 @@ class ObjectBase(ObjectGen):
|
|||||||
self.movable = movable
|
self.movable = movable
|
||||||
self.actor = actor
|
self.actor = actor
|
||||||
self.named = named
|
self.named = named
|
||||||
|
# to maintain order of properties in UI
|
||||||
self.orderedProperties = orderedProperties[:]
|
self.orderedProperties = orderedProperties[:]
|
||||||
|
# to show/hide properties per editor mode
|
||||||
|
self.propertiesMask = copy.deepcopy(propertiesMask)
|
||||||
|
|
||||||
class ObjectPaletteBase:
|
class ObjectPaletteBase:
|
||||||
"""
|
"""
|
||||||
|
@ -343,6 +343,16 @@ class ObjectPropertyUI(ScrolledPanel):
|
|||||||
propNames.append(key)
|
propNames.append(key)
|
||||||
|
|
||||||
for key in propNames:
|
for key in propNames:
|
||||||
|
# handling properties mask
|
||||||
|
propMask = BitMask32()
|
||||||
|
for modeKey in objDef.propertiesMask.keys():
|
||||||
|
if key in objDef.propertiesMask[modeKey]:
|
||||||
|
propMask |= modeKey
|
||||||
|
|
||||||
|
if not propMask.isZero():
|
||||||
|
if (self.editor.mode & propMask).isZero():
|
||||||
|
continue
|
||||||
|
|
||||||
propDef = objDef.properties[key]
|
propDef = objDef.properties[key]
|
||||||
propType = propDef[OG.PROP_TYPE]
|
propType = propDef[OG.PROP_TYPE]
|
||||||
propDataType = propDef[OG.PROP_DATATYPE]
|
propDataType = propDef[OG.PROP_DATATYPE]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user