mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
factory editor framework
This commit is contained in:
parent
bb3925c992
commit
4a01fe9851
@ -355,3 +355,20 @@ class DistributedLevel(DistributedObject.DistributedObject,
|
|||||||
|
|
||||||
entity = self.getEntity(entId)
|
entity = self.getEntity(entId)
|
||||||
entity.handleAttribChange(attribName, value)
|
entity.handleAttribChange(attribName, value)
|
||||||
|
|
||||||
|
"""
|
||||||
|
if __debug__:
|
||||||
|
# if someone has edited the level, we'll get the full up-to-date
|
||||||
|
# spec in this message
|
||||||
|
def setSpecOverride(self, specStr):
|
||||||
|
if self.spec is not None:
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.spec = eval(specStr)
|
||||||
|
except Exception, e:
|
||||||
|
print ('Exception in %s(%s):\n\t%s' %
|
||||||
|
(lineInfo()[2], specStr, e))
|
||||||
|
raise e
|
||||||
|
"""
|
||||||
|
|
||||||
|
@ -109,3 +109,14 @@ class DistributedLevelAI(DistributedObjectAI.DistributedObjectAI,
|
|||||||
|
|
||||||
entity = self.getEntity(entId)
|
entity = self.getEntity(entId)
|
||||||
entity.handleAttribChange(attribName, value)
|
entity.handleAttribChange(attribName, value)
|
||||||
|
|
||||||
|
# send a copy of the entire spec for any new users that
|
||||||
|
# might come in
|
||||||
|
##self.sendUpdate('setSpecOverride', [repr(self.spec)])
|
||||||
|
|
||||||
|
"""
|
||||||
|
def getSpecOverride(self):
|
||||||
|
# This is the value we'll send until someone actually edits
|
||||||
|
# the level
|
||||||
|
return repr(None)
|
||||||
|
"""
|
||||||
|
@ -16,23 +16,16 @@ class Entity:
|
|||||||
('comment', str, 0),
|
('comment', str, 0),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, level=None, entId=None, attribs=None):
|
def __init__(self, level=None, entId=None):
|
||||||
if level is not None and entId is not None:
|
self.initializeEntity(level, entId)
|
||||||
self.initializeEntity(level, entId, attribs)
|
|
||||||
else:
|
def initializeEntity(self, level, entId):
|
||||||
|
"""Distributed entities don't know their level or entId values
|
||||||
|
until they've been generated, so they call this after they've
|
||||||
|
been generated. At that point, the entity is good to go."""
|
||||||
self.level = level
|
self.level = level
|
||||||
self.entId = entId
|
self.entId = entId
|
||||||
self.attribs = Entity.Attribs
|
if (self.level is not None) and (self.entId is not None):
|
||||||
|
|
||||||
def initializeEntity(self, level, entId, attribs=None):
|
|
||||||
self.level = level
|
|
||||||
self.entId = entId
|
|
||||||
|
|
||||||
self.attribs = Entity.Attribs
|
|
||||||
# add any additional tweakable values
|
|
||||||
if attribs is not None:
|
|
||||||
self.attribs.update(attribs)
|
|
||||||
|
|
||||||
self.level.initializeEntity(self)
|
self.level.initializeEntity(self)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -7,7 +7,8 @@ from PythonUtil import lineInfo
|
|||||||
"""
|
"""
|
||||||
Any data that can be edited by a level editor must be represented as
|
Any data that can be edited by a level editor must be represented as
|
||||||
an attribute of an entity owned by the level, in order to keep the
|
an attribute of an entity owned by the level, in order to keep the
|
||||||
level-editing interface simple and unchanging.
|
level-editing interface simple and constant (there are at least three
|
||||||
|
places where the entire editing interface must be duplicated).
|
||||||
|
|
||||||
To support this, we have entities such as 'levelMgr' and 'zoneEntity' that
|
To support this, we have entities such as 'levelMgr' and 'zoneEntity' that
|
||||||
contain crucial level information, much of which is needed when setting
|
contain crucial level information, much of which is needed when setting
|
||||||
@ -15,8 +16,6 @@ up the level object, and is needed before other entity types can be
|
|||||||
effectively created. (If you try to create a distributed entity, but
|
effectively created. (If you try to create a distributed entity, but
|
||||||
you don't yet have the information for the zone that it's in, because
|
you don't yet have the information for the zone that it's in, because
|
||||||
you haven't created the zone's ZoneEntity, you're hurting.)
|
you haven't created the zone's ZoneEntity, you're hurting.)
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -35,7 +34,7 @@ class LevelBase:
|
|||||||
UberZoneEntId = 0
|
UberZoneEntId = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
self.spec = None
|
||||||
|
|
||||||
def initializeLevel(self, levelId, spec, scenarioIndex):
|
def initializeLevel(self, levelId, spec, scenarioIndex):
|
||||||
""" subclass should call this as soon as it has located
|
""" subclass should call this as soon as it has located
|
||||||
|
Loading…
x
Reference in New Issue
Block a user