public static void RageGroupApplyTexturing()
    {
        var selectedGameObject = Selection.activeTransform.gameObject;

        if (!HasSplineAndGroup(selectedGameObject))
        {
            Debug.Log("Macro Error: First select a RageSpline object which has a parent or attached RageGroup");
            return;
        }
        Vector2 offset    = _refSpline.GetTextureOffset();
        float   angleDeg  = _refSpline.GetTextureAngleDeg();
        float   scaleInv  = _refSpline.GetTextureScaleInv();
        Vector2 offset2   = _refSpline.GetTextureOffset2();
        float   angle2Deg = _refSpline.GetTextureAngle2Deg();
        float   scale2Inv = _refSpline.GetTextureScale2Inv();

        foreach (RageGroupElement groupItem in _group.List)
        {
            RageSpline thisSpline  = groupItem.Spline.Rs;
            Vector2    offsetDelta = _refSpline.transform.position - thisSpline.transform.position;
            RageSpline.CopyStyling(ref _refSpline, thisSpline);
            thisSpline.CopyMaterial(_refSpline);
            thisSpline.SetTextureOffset(offset + offsetDelta);
            thisSpline.SetTextureAngleDeg(angleDeg);
            thisSpline.SetTextureScaleInv(scaleInv);
            thisSpline.SetTextureOffset2(offset2 + offsetDelta);
            thisSpline.SetTextureAngle2Deg(angle2Deg);
            thisSpline.SetTextureScale2Inv(scale2Inv);
            thisSpline.RefreshMeshInEditor(true, true, true);
        }
        Debug.Log("Macro: Texturing applied to all RageGroup members.");
    }
 public void Redraw(bool triangulate, bool calculateNormals, bool calculatePhysics, bool draft)
 {
     if (_rageSpline == null)
     {
         return;
     }
     _rageSpline.FlattenZ    = false;
     _rageSpline.FixOverlaps = !draft;
     if (!draft)
     {
         _rageSpline.RefreshMeshInEditor(true, true, true);
         //_rageSpline.Redraw (true, true, true, 0, 1f);
         return;
     }
     _currentStartNormals = _rageSpline.Redraw(_rageSpline.spline.Triangulate, calculateNormals, calculatePhysics, _currentStartNormals, 0.5f);          // ProgressiveNormalsPrecalc);
 }
Exemple #3
0
    private void GeneralSettings(RageSpline rageSpline)
    {
        EditorGUIUtility.LookLikeControls(170f, 10f);
        GuiExtensions.Vertical (GUI.skin.box, ( ) => {
            GuiExtensions.Horizontal (( ) => EditorGUILayout.LabelField ("   General:", ""));
            var vDensity = EditorGUILayout.IntField("      Vertex density", rageSpline.VertexDensity);
            if (_currentVertexDensity != vDensity) {
                _currentVertexDensity = vDensity;
                rageSpline.VertexDensity = vDensity;
            }

            var vCount = EditorGUILayout.IntField ("      Vertex count", !rageSpline.lowQualityRender
                                                                        ? rageSpline.GetVertexCount()
                                                                        : rageSpline.vertexCount);
            if (vCount != _currentVertexCount) {
                _currentVertexCount = vCount;
                rageSpline.SetVertexCount(vCount);
            }
            rageSpline.SetAntialiasingWidth (EditorGUILayout.FloatField ("      Anti-aliasing width", rageSpline.GetAntialiasingWidth()));
            rageSpline.SetOptimize (EditorGUILayout.Toggle ("      Optimize", rageSpline.GetOptimize()));
            if (rageSpline.GetOptimize())
                rageSpline.SetOptimizeAngle(EditorGUILayout.FloatField("      Optimize Angle", rageSpline.GetOptimizeAngle()));
            rageSpline.PerspectiveMode = EditorGUILayout.Toggle("      3D Mode", rageSpline.PerspectiveMode);
            if (rageSpline.CurrentPerspective != rageSpline.PerspectiveMode) {
                rageSpline.SwitchPerspectiveMode();
                EditorUtility.SetDirty(target);
                rageSpline.CurrentPerspective = rageSpline.PerspectiveMode;
                rageSpline.RefreshMeshInEditor(true,true,true);
            }

            displayOptions = EditorGUILayout.Foldout(displayOptions, "    Display Options");
            if (displayOptions) {
                rageSpline.showSplineGizmos = EditorGUILayout.Toggle("          Show spline gizmos", rageSpline.showSplineGizmos);
                rageSpline.showOtherGizmos = EditorGUILayout.Toggle("          Show other gizmos", rageSpline.showOtherGizmos);
                rageSpline.showWireFrameInEditor = EditorGUILayout.Toggle("          Show wireframe", rageSpline.showWireFrameInEditor);
                rageSpline.hideHandles = !(EditorGUILayout.Toggle("          Show handles", !rageSpline.hideHandles));
                rageSpline.ShowTriangleCount = EditorGUILayout.Toggle("          Show tri count", rageSpline.ShowTriangleCount);
                if (rageSpline.ShowTriangleCount)
                    EditorGUILayout.FloatField("      Triangle Count", rageSpline.GetTriangleCount());
            }
        });
        EditorGUILayout.Separator();
    }