mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
36 lines
1.0 KiB
Python
Executable File
36 lines
1.0 KiB
Python
Executable File
from ToontownGlobals import *
|
|
import DirectNotifyGlobal
|
|
import BasicEntities
|
|
|
|
class ModelEntity(BasicEntities.NodePathEntity):
|
|
def __init__(self, level, entId):
|
|
BasicEntities.NodePathEntity.__init__(self, level, entId)
|
|
self.model = None
|
|
self.loadModel()
|
|
|
|
def destroy(self):
|
|
if self.model:
|
|
self.model.removeNode()
|
|
del self.model
|
|
BasicEntities.NodePathEntity.destroy(self)
|
|
|
|
def loadModel(self):
|
|
if self.model:
|
|
self.model.removeNode()
|
|
self.model = None
|
|
if self.modelPath:
|
|
self.model = loader.loadModel(self.modelPath)
|
|
if self.model:
|
|
self.model.reparentTo(self)
|
|
|
|
# HACK SDN: special code for moving crate wall collisions down
|
|
if self.modelPath == "phase_9/models/cogHQ/woodCrateB.bam":
|
|
cNode = self.find("**/wall")
|
|
if not cNode.isEmpty():
|
|
cNode.setZ(-.5)
|
|
|
|
def setModelPath(self, path):
|
|
self.modelPath = path
|
|
self.loadModel()
|
|
|