UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

24 lines (23 loc) 924 B
"use strict"; import { ObjectNamedFunction3 } from "./_Base"; import { getOrCreateObjectAttributeRef } from "../../core/reactivity/ObjectAttributeReactivityCreateRef"; import { _matchArrayLengthWithType } from "./_ArrayUtils"; import { getObjectChildrenCountRef } from "../../core/reactivity/ObjectHierarchyReactivity"; import { dummyReadRefVal } from "./_Param"; export class getChildrenAttributesPrevious extends ObjectNamedFunction3 { static type() { return "getChildrenAttributesPrevious"; } func(object3D, attribName, type, values) { dummyReadRefVal(getObjectChildrenCountRef(object3D).value); _matchArrayLengthWithType(object3D.children, values, type); let i = 0; const children = object3D.children; for (let child of children) { const _refs = getOrCreateObjectAttributeRef(child, attribName, type); values[i] = _refs.previous.value; i++; } return values; } }