addDragUpdatePart() public static method

public static addDragUpdatePart ( Part part ) : void
part Part
return void
Beispiel #1
0
 /// <summary>
 /// Updates part highlight renderer list, sends message to SSTUFlagDecal to update its renderer,
 ///  sends message to FAR to update voxels, or if createDefaultCube==true will re-render the 'default' stock drag cube for the part<para/>
 /// Should be called anytime the model geometry in a part is changed -- either models added/deleted, procedural meshes updated.  Other methods exist for pure drag-cube updating in SSTUStockInterop.
 /// </summary>
 /// <param name="part"></param>
 /// <param name="createDefaultCube"></param>
 public static void onPartGeometryUpdate(Part part, bool createDefaultCube)
 {
     if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
     {
         return;
     }                                                                                //noop on prefabs
     //MonoBehaviour.print(System.Environment.StackTrace);
     SSTUStockInterop.updatePartHighlighting(part);
     part.airlock = locateAirlock(part);
     partGeometryUpdate(part);
     if (isFARInstalled())
     {
         SSTUStockInterop.addFarUpdatePart(part);
         //FARdebug(part);
         //part.SendMessage("GeometryPartModuleRebuildMeshData");
     }
     else if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
     {
         SSTUStockInterop.addDragUpdatePart(part);
     }
     if (HighLogic.LoadedSceneIsEditor && part.parent == null && part != EditorLogic.RootPart) //likely the part under the cursor; this fixes problems with modular parts not wanting to attach to stuff
     {
         part.gameObject.SetLayerRecursive(1, 2097152);                                        //1<<21 = Part Triggers get skipped by the relayering (hatches, ladders, ??)
     }
 }
Beispiel #2
0
 /// <summary>
 /// Internal method to update the persistent data state(s) from the current animation state.
 /// </summary>
 /// <param name="newState"></param>
 protected void onAnimationStateChange(AnimState newState, bool updateExternal = false)
 {
     animationState = newState;
     persistentData = newState.ToString();
     if (updateDragCube)
     {
         SSTUStockInterop.addDragUpdatePart(part);
     }
     if (updateExternal && onAnimStateChangeCallback != null)
     {
         onAnimStateChangeCallback(newState);
     }
 }
Beispiel #3
0
 public static void onPartGeometryUpdate(Part part, bool createDefaultCube)
 {
     if (!HighLogic.LoadedSceneIsEditor && !HighLogic.LoadedSceneIsFlight)
     {
         return;
     }                                                //noop on prefabs
     //MonoBehaviour.print(System.Environment.StackTrace);
     part.HighlightRenderers = null;                  //force refresh of part highlighting
     part.SendMessage("onPartGeometryChanged", part); //used by SSTUFlagDecal and potentially others in the future
     if (isFARInstalled())
     {
         part.SendMessage("GeometryPartModuleRebuildMeshData");
     }
     else if (createDefaultCube && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
     {
         SSTUStockInterop.addDragUpdatePart(part);
     }
 }