Ejemplo n.º 1
0
                log.debug("|{0}| >> assuming midPoint...".format(_str_func))
                return getAndMove(_loc, _targets, 'midPoint', forceBBCenter)
            else:
                log.debug("|{0}| >> singleTarget...".format(_str_func))
                _d = POS.get_info(_targets, boundingBox=forceBBCenter)
                position(_loc, _d)
                return True
        else:
            log.debug("|{0}| >> tagged...".format(_str_func))
            _mode = SEARCH.get_nodeTagInfo(_loc, 'cgmLocMode')
            if _mode == 'fromTarget':
                _targets = ATTR.get_message(_loc, 'cgmLocSource', 'cgmLocDat')
                return getAndMove(_loc, _targets, _mode, forceBBCenter)

            elif _mode == 'midPoint':
                _targets = ATTR.msgList_get(_loc, 'cgmLocSource', 'cgmLocDat')
                return getAndMove(_loc, _targets, _mode, forceBBCenter)

            elif _mode == 'closestPoint':
                _targets = ATTR.msgList_get(_loc, 'cgmLocSource', 'cgmLocDat')
                return getAndMove(_loc, _targets, _mode, forceBBCenter)

            elif _mode == 'closestTarget':
                _targets = ATTR.msgList_get(_loc, 'cgmLocSource', 'cgmLocDat')
                log.debug("|{0}| >> targets: {1}".format(_str_func, _targets))
                return getAndMove(_loc, _targets, _mode, forceBBCenter)
            elif _mode == 'rayCast':
                _target = ATTR.get_message(_loc, 'meshTarget')
                return getAndMove(_loc, _target, _mode)
            else:
                log.error("|{0}| >> unknown mode: {1}".format(
Ejemplo n.º 2
0
#What if we wanna mix and match
_l_values = [1,2.0,[1.1,2,4],[1,2,3,4,5,6],False,'cat',_ml_targets[0].mNode]
ATTR.datList_connect(_mi_catcher.mNode,'values',_l_values)#...New list, different attribute types
ATTR.datList_get(_mi_catcher.mNode,'values')#Gets our values


#However, if we anna deal with objects and not simple values, we need to move on to msgList...
#First let's clean up our object
ATTR.datList_purge(_mi_catcher.mNode,'values')#...
ATTR.datList_purge(_mi_catcher.mNode,'strings')#...

ATTR.msgList_connect(_mi_catcher.mNode,'example',_ml_targets)#...we can do a simple message connection or...
ATTR.msgList_connect(_mi_catcher.mNode,'example',_ml_targets,'source')#...do it with a connect back on each target

ATTR.msgList_get(_mi_catcher.mNode,'example')#...gets our return

#...this is all fine and dandy but what if we wanna store more specific message data, like an attribute or a component....
ATTR.msgList_append(_mi_catcher.mNode,'example',"{0}.tx".format(_ml_targets[0].mNode))
#...you'll note a new json dict attribute has been created. This is how we store our extra stuff

ATTR.msgList_get(_mi_catcher.mNode,'example')#...gets our new list with our extra object

ATTR.msgList_append(_mi_catcher.mNode,'example',"{0}.tx".format(_ml_targets[0].mNode))


ATTR.msgList_append(_mi_catcher.mNode,'example',"{0}.vtx[120:122]".format(_ml_targets[1].mNode))
ATTR.msgList_get(_mi_catcher.mNode,'example')#...gets our new list with our message component...

ATTR.msgList_index(_mi_catcher.mNode,'example',"{0}.vtx[120:122]".format(_ml_targets[1].mNode))#...can index