mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added ParamObj.getCurrentParams
This commit is contained in:
parent
2b22c30352
commit
2527c1bb07
@ -1174,6 +1174,12 @@ class ParamObj:
|
|||||||
for param in self.getParams():
|
for param in self.getParams():
|
||||||
getSetter(obj, param)(self.getValue(param))
|
getSetter(obj, param)(self.getValue(param))
|
||||||
obj.unlockParams()
|
obj.unlockParams()
|
||||||
|
def extractFrom(self, obj):
|
||||||
|
# Extract our entire set of params from a ParamObj
|
||||||
|
obj.lockParams()
|
||||||
|
for param in self.getParams():
|
||||||
|
self.paramVals[param] = getSetter(obj, param, 'get')()
|
||||||
|
obj.unlockParams()
|
||||||
# CLASS METHODS
|
# CLASS METHODS
|
||||||
def getParams(cls):
|
def getParams(cls):
|
||||||
# returns safely-mutable list of param names
|
# returns safely-mutable list of param names
|
||||||
@ -1202,6 +1208,13 @@ class ParamObj:
|
|||||||
# apply this class' default param values to our dict
|
# apply this class' default param values to our dict
|
||||||
cls._Params.update(c.Params)
|
cls._Params.update(c.Params)
|
||||||
_compileDefaultParams = classmethod(_compileDefaultParams)
|
_compileDefaultParams = classmethod(_compileDefaultParams)
|
||||||
|
def __repr__(self):
|
||||||
|
argStr = ''
|
||||||
|
for param in self.getParams():
|
||||||
|
argStr += '%s=%s,' % (param,
|
||||||
|
repr(self.getValue(param)))
|
||||||
|
return '%s.%s(%s)' % (
|
||||||
|
self.__class__.__module__, self.__class__.__name__, argStr)
|
||||||
# END PARAMSET SUBCLASS
|
# END PARAMSET SUBCLASS
|
||||||
|
|
||||||
def __init__(self, *args, **kwArgs):
|
def __init__(self, *args, **kwArgs):
|
||||||
@ -1304,6 +1317,11 @@ class ParamObj:
|
|||||||
# set all the default parameters on ourself
|
# set all the default parameters on ourself
|
||||||
self.ParamSet().applyTo(self)
|
self.ParamSet().applyTo(self)
|
||||||
|
|
||||||
|
def getCurrentParams(self):
|
||||||
|
params = self.ParamSet()
|
||||||
|
params.extractFrom(self)
|
||||||
|
return params
|
||||||
|
|
||||||
def lockParams(self):
|
def lockParams(self):
|
||||||
self._paramLockRefCount += 1
|
self._paramLockRefCount += 1
|
||||||
if self._paramLockRefCount == 1:
|
if self._paramLockRefCount == 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user