Example #1
0
        UsdSchema usdiFindOrCreateNode(Transform parent, usdi.Schema schema, ref bool created)
        {
            GameObject go = null;

            // find existing GameObject or create new one
            var name  = usdi.usdiPrimGetNameS(schema);
            var child = parent.FindChild(name);

            if (child != null)
            {
                go      = child.gameObject;
                created = false;
            }
            else if (go == null)
            {
                go      = new GameObject();
                go.name = name;
                go.GetComponent <Transform>().SetParent(parent, false);
                created = true;
            }

            // create USD node
            UsdSchema ret = usdiCreateNode(schema);

            ret.gameObject = go;

            return(ret);
        }
Example #2
0
        public virtual void usdiOnLoad()
        {
            m_primPath     = usdi.usdiPrimGetPathS(m_schema);
            m_primTypeName = usdi.usdiPrimGetUsdTypeNameS(m_schema);
            m_master       = m_stream.usdiFindSchema(usdi.usdiPrimGetMaster(m_schema));

            usdiSyncVarinatSets();
            usdiSyncImportSettings();
            if (m_goAssigned)
            {
                var c = usdiSetupSchemaComponent();
                c.schema = this;
            }
        }
Example #3
0
        UsdSchema usdiCreateNode(usdi.Schema schema)
        {
            UsdSchema ret = null;

            if (ret == null)
            {
                var s = usdi.usdiAsPoints(schema);
                if (s)
                {
                    ret = new UsdPoints();
                }
            }
            if (ret == null)
            {
                var s = usdi.usdiAsMesh(schema);
                if (s)
                {
                    ret = new UsdMesh();
                }
            }
            if (ret == null)
            {
                var s = usdi.usdiAsCamera(schema);
                if (s)
                {
                    ret = new UsdCamera();
                }
            }
            if (ret == null)
            {
                // Xform must be latter because some schemas are subclass of Xform
                var s = usdi.usdiAsXform(schema);
                if (s)
                {
                    ret = new UsdXform();
                }
            }
            if (ret == null)
            {
                ret = new UsdSchema();
            }
            ret.nativeSchemaPtr = schema;
            ret.stream          = this;
            return(ret);
        }