protected override bool buildCreateObjects( bool reload_asset, ref HoudiniProgressBar progress_bar ) { bool needs_recook = false; for ( int object_index = 0; object_index < prObjectCount; ++object_index ) { progress_bar.incrementProgressBar(); try { if ( !prObjects[ object_index ].isInstancer && ( reload_asset || prObjects[ object_index ].hasTransformChanged || prObjects[ object_index ].haveGeosChanged ) ) { needs_recook |= createObject( object_index, reload_asset ); } } catch ( HoudiniError error ) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning( error.ToString() ); } } // Processing instancers. for ( int object_index = 0; object_index < prObjectCount; ++object_index ) { HAPI_ObjectInfo object_info = prObjects[ object_index ]; if ( object_info.isInstancer ) { try { if ( object_info.objectToInstanceId >= 0 && prGameObjects[ object_info.objectToInstanceId ] == null ) needs_recook |= createObject( object_info.objectToInstanceId, reload_asset ); if( reload_asset || object_info.haveGeosChanged ) instanceObjects( object_index, progress_bar ); } catch ( HoudiniError error ) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning( error.ToString() ); } } } // Enumerate edit and paint geos. HoudiniGeoControl[] geo_controls = gameObject.GetComponentsInChildren< HoudiniGeoControl >(); prEditPaintGeos.Clear(); foreach ( HoudiniGeoControl geo_control in geo_controls ) { if ( geo_control.prGeoType == HAPI_GeoType.HAPI_GEOTYPE_INTERMEDIATE && geo_control.GetType() == typeof( HoudiniGeoControl ) ) { prEditPaintGeos.Add( geo_control ); } } if ( prEditPaintGeos.Count > 0 && prActiveAttributeManager == null ) prActiveAttributeManager = prEditPaintGeos[ 0 ].prGeoAttributeManager; return needs_recook; }
protected override bool buildCreateObjects(bool reload_asset, ref HoudiniProgressBar progress_bar) { bool needs_recook = false; for (int object_index = 0; object_index < prObjectCount; ++object_index) { progress_bar.incrementProgressBar(); try { if (!prObjects[object_index].isInstancer && (reload_asset || prObjects[object_index].hasTransformChanged || prObjects[object_index].haveGeosChanged)) { needs_recook |= createObject(object_index, reload_asset); } } catch (HoudiniError error) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning(error.ToString()); } } // Processing instancers. for (int object_index = 0; object_index < prObjectCount; ++object_index) { HAPI_ObjectInfo object_info = prObjects[object_index]; if (object_info.isInstancer) { try { if (object_info.objectToInstanceId >= 0 && prGameObjects[object_info.objectToInstanceId] == null) { needs_recook |= createObject(object_info.objectToInstanceId, reload_asset); } if (reload_asset || object_info.haveGeosChanged) { instanceObjects(object_index, progress_bar); } } catch (HoudiniError error) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning(error.ToString()); } } } // Enumerate edit and paint geos. HoudiniGeoControl[] geo_controls = gameObject.GetComponentsInChildren <HoudiniGeoControl>(); prEditPaintGeos.Clear(); foreach (HoudiniGeoControl geo_control in geo_controls) { if (geo_control.prGeoType == HAPI_GeoType.HAPI_GEOTYPE_INTERMEDIATE && geo_control.GetType() == typeof(HoudiniGeoControl)) { prEditPaintGeos.Add(geo_control); } } if (prEditPaintGeos.Count > 0 && prActiveAttributeManager == null) { prActiveAttributeManager = prEditPaintGeos[0].prGeoAttributeManager; } return(needs_recook); }
protected override void buildFullBuildCustomWork( ref HoudiniProgressBar progress_bar, bool is_duplication ) { // Initialize (or leave alone!) the pain structs. if ( prEditPaintGeos == null ) { prEditPaintGeos = new List< HoudiniGeoControl >(); prActiveAttributeManager = null; } else if ( is_duplication ) { prActiveAttributeManager = null; } progress_bar.prMessage = "Loading handles..."; // Get exposed handle information. prHandleInfos = new HAPI_HandleInfo[ prHandleCount ]; HoudiniAssetUtility.getArray1Id( prAssetId, HoudiniHost.getHandleInfo, prHandleInfos, prHandleCount ); // Get handles. prHandleBindingInfos = new List< HAPI_HandleBindingInfo[] >( prHandleCount ); for ( int handle_index = 0; handle_index < prHandleCount; ++handle_index ) { progress_bar.incrementProgressBar(); HAPI_HandleInfo handle_info = prHandleInfos[ handle_index ]; HAPI_HandleBindingInfo[] binding_infos = new HAPI_HandleBindingInfo[ handle_info.bindingsCount ]; HoudiniAssetUtility.getArray2Id( prAssetId, handle_index, HoudiniHost.getHandleBindingInfo, binding_infos, handle_info.bindingsCount ); prHandleBindingInfos.Add( binding_infos ); } }
protected override bool buildCreateObjects(bool reload_asset, ref HoudiniProgressBar progress_bar) { bool needs_recook = false; for (int object_index = 0; object_index < prObjectCount; ++object_index) { progress_bar.incrementProgressBar(); try { if (!prObjects[object_index].isInstancer && (reload_asset || prObjects[object_index].hasTransformChanged || prObjects[object_index].haveGeosChanged)) { needs_recook |= createObject(object_index, reload_asset); } } catch (HoudiniError error) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning(error.ToString()); } } // Processing instancers. for (int object_index = 0; object_index < prObjectCount; ++object_index) { HAPI_ObjectInfo object_info = prObjects[object_index]; if (object_info.isInstancer) { try { if (object_info.objectToInstanceId >= 0) { int instanced_object_index = findObjectByNodeId(object_info.objectToInstanceId); if (instanced_object_index >= 0) { needs_recook |= createObject(instanced_object_index, reload_asset); } } if (reload_asset || object_info.haveGeosChanged) { instanceObjects(object_info.nodeId, object_index, progress_bar); } } catch (HoudiniError error) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. Debug.LogWarning(error.ToString()); } } } if (prObjectCount <= 0) { bool needs_init = prObjectInfo.nodeId < 0 || reload_asset; if (prNodeInfo.type == HAPI_NodeType.HAPI_NODETYPE_OBJ) { prObjectInfo = HoudiniHost.getObjectInfo(prAssetId); } else if (prNodeInfo.type == HAPI_NodeType.HAPI_NODETYPE_SOP) { prObjectInfo = HoudiniHost.getObjectInfo(prNodeInfo.parentId); } else { Debug.LogError("Unsupported asset type!"); return(needs_recook); } if (needs_init) { init( prAssetId, prNodeId, prAsset, prObjectInfo.nodeId, prObjectInfo.name, prObjectInfo.isVisible); } needs_recook = refresh(reload_asset, prObjectInfo); } // Enumerate edit and paint geos. HoudiniGeoControl[] geo_controls = gameObject.GetComponentsInChildren <HoudiniGeoControl>(); prEditPaintGeos.Clear(); foreach (HoudiniGeoControl geo_control in geo_controls) { if (geo_control.prGeoType == HAPI_GeoType.HAPI_GEOTYPE_INTERMEDIATE && geo_control.GetType() == typeof(HoudiniGeoControl)) { prEditPaintGeos.Add(geo_control); } } if (prEditPaintGeos.Count > 0 && prActiveAttributeManager == null) { prActiveAttributeManager = prEditPaintGeos[0].prGeoAttributeManager; } return(needs_recook); }