Exemple #1
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Repeaters/Grid Repeater")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("GridRepeater");
         * }
         */

        public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false)
        {
            base.drawBoundsHandles(generator.parametricObject.worldDisplayMatrix, forceDraw);

            RepeaterTool repeaterToolU = (parametricObject.generator as GridRepeater).repeaterToolU;
            RepeaterTool repeaterToolV = (parametricObject.generator as GridRepeater).repeaterToolV;



            if (repeaterToolU != null && repeaterToolV != null)
            {
                // DRAW GRID
                Handles.color = new Color(1, .5f, 0, .4f);

                Matrix4x4 prevHandleMatrix = Handles.matrix;

                Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix;

                Handles.matrix = context;

                for (int i = 0; i <= repeaterToolU.cells; i++)
                {
                    Handles.DrawLine(new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, -repeaterToolV.size / 2), new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, repeaterToolV.size / 2));
                }

                for (int k = 0; k <= repeaterToolV.cells; k++)
                {
                    Handles.DrawLine(new Vector3(-repeaterToolU.size / 2, 0, -repeaterToolV.size / 2 + k * repeaterToolV.actualBay), new Vector3(repeaterToolU.size / 2, 0, -repeaterToolV.size / 2 + k * repeaterToolV.actualBay));
                }



                // ASK RepeaterTools to DRAW

                // - U TOOL
                GeneratorHandler gh = getGeneratorHandler(repeaterToolU.parametricObject);
                if (gh != null)
                {
                    //Handles.matrix = context *   Matrix4x4.TRS(new Vector3(0, 0, 1f*repeaterToolV.bay+repeaterToolV.size/2), Quaternion.Euler(-90, 0, 0), Vector3.one);
                    Handles.matrix = context * Matrix4x4.TRS(new Vector3(0, 0, repeaterToolV.size / 2), Quaternion.Euler(-90, 0, 0), Vector3.one);

                    gh.drawBoundsHandles(context, true);
                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                }

                // - V TOOL
                gh = getGeneratorHandler(repeaterToolV.parametricObject);
                if (gh != null)
                {
                    Handles.matrix = context * Matrix4x4.TRS(new Vector3(repeaterToolU.size / 2, 0, 0), Quaternion.Euler(90, -90, 0), Vector3.one);
                    gh.drawBoundsHandles(context, true);

                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                }

                Handles.matrix = prevHandleMatrix;
            }
        }
        // L :: DRAW_CONTROL_HANDLES_OF_INPUT_PARAMETRIC_OBJECTS
        public override void drawControlHandlesofInputParametricObjects(ref List <string> visited, Matrix4x4 consumerM)
        {
            Lofter gener = (generator as Lofter);


            //if (alreadyVisited(ref visited, "LofterHandler"))
            //	return;

            Matrix4x4 prevHandlesMatrix = Handles.matrix;


            foreach (AXParameter input in gener.inputs)
            {
                if (input.DependsOn != null)
                {
                    GeneratorHandler gh = getGeneratorHandler(input.DependsOn.parametricObject);

                    //Debug.Log(input.DependsOn.parametricObject.Name);

                    Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, 0), Vector3.one);

                    if (gh != null)
                    {
                        Handles.matrix = context * Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0), Vector3.one);

                        gh.drawBoundsHandles(context, true);

                        //List<string> _visited = new List<string>();
                        gh.drawControlHandles(ref visited, consumerM, true);
                    }
                }
            }
        }
Exemple #3
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Repeaters/Radial Repeater")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("RadialRepeater");
         * }
         */

        public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false)
        {
            base.drawBoundsHandles(consumerM, forceDraw);

            RadialRepeaterTool radialRepeaterTool = (generator as RadialRepeater).repeaterToolU as RadialRepeaterTool;

            Matrix4x4 prevHandleMatrix = Handles.matrix;

            float depth = .55f * HandleUtility.GetHandleSize(Vector3.zero);

            Matrix4x4 context = Matrix4x4.TRS(new Vector3(0, -depth, 0), Quaternion.identity, Vector3.one) * parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix;

            Handles.matrix = context;

            if (radialRepeaterTool != null)
            {
                // REPEATER TOOL HANDLER
                GeneratorHandler gh = getGeneratorHandler(radialRepeaterTool.parametricObject);

                if (gh != null)
                {
                    //Handles.matrix *= Matrix4x4.TRS(new Vector3(parametricObject.bounds.extents.x, radialRepeaterTool.size/2, 0), Quaternion.Euler(0, 0, 90), Vector3.one);
                    gh.drawBoundsHandles(consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);

                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                }
            }

            Handles.matrix = prevHandleMatrix;
        }
Exemple #4
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Repeaters/Linear Repeater")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("FloorRepeater");
         * }
         */
        public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false)
        {
            base.drawBoundsHandles(consumerM, forceDraw);

            RepeaterTool repeaterTool = (parametricObject.generator as FloorRepeater).repeaterTool;


            Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix;

            Handles.matrix = context;

            if (repeaterTool != null)
            {
                GeneratorHandler gh = getGeneratorHandler(repeaterTool.parametricObject);

                if (gh != null)
                {
                    Handles.matrix *= Matrix4x4.TRS(new Vector3(parametricObject.bounds.extents.x, repeaterTool.size / 2, 0), Quaternion.Euler(0, 0, 90), Vector3.one);
                    gh.drawBoundsHandles(consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);

                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                }
            }
        }
Exemple #5
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Repeaters/Plan Repeater")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("PlanRepeater");
         * }
         */

        public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false)
        {
            base.drawBoundsHandles(consumerM, forceDraw);

            RepeaterTool repeaterTool = (parametricObject.generator as PlanRepeater).repeaterTool;

            if (repeaterTool != null)
            {
                GeneratorHandler gh = getGeneratorHandler(repeaterTool.parametricObject);

                if (gh != null)
                {
                    consumerM *= Matrix4x4.TRS(new Vector3(parametricObject.bounds.extents.x, repeaterTool.size / 2, 0), Quaternion.Euler(0, 0, 90), Vector3.one);
                    gh.drawBoundsHandles(consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix(), true);
                }
            }
        }
Exemple #6
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Repeaters/Linear Repeater")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("LinearRepeater");
         * }
         */
        public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false)
        {
            base.drawBoundsHandles(consumerM, forceDraw);

            LinearRepeater repeater = (parametricObject.generator as LinearRepeater);

            RepeaterTool repeaterTool = repeater.repeaterToolU;

            if (repeater.zAxis)
            {
                repeaterTool = repeater.repeaterToolV;
            }



            Matrix4x4 prevHandleMatrix = Handles.matrix;

            Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix;

            Handles.matrix = context;

            if (repeaterTool != null)
            {
                GeneratorHandler gh = getGeneratorHandler(repeaterTool.parametricObject);

                if (gh != null)
                {
                    if (repeater.zAxis)
                    {
                        Handles.matrix *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 90, 0), Vector3.one);
                    }

                    gh.drawBoundsHandles(context, true);

                    List <string> visited = new List <string>();
                    gh.drawControlHandles(ref visited, context, true);
                }
            }

            Handles.matrix = prevHandleMatrix;
        }
        public override void drawControlHandles(ref List <string> visited, Matrix4x4 consumerM, bool beingDrawnFromConsumer)
        {
            if (alreadyVisited(ref visited, "GridRepeater2DHandler"))
            {
                return;
            }

            Matrix4x4 prevHandlesMatrix = Handles.matrix;

            base.drawControlHandles(ref visited, consumerM, beingDrawnFromConsumer);


            RepeaterTool repeaterToolU = (parametricObject.generator as GridRepeater2D).repeaterToolU;
            RepeaterTool repeaterToolV = (parametricObject.generator as GridRepeater2D).repeaterToolV;



            if (repeaterToolU != null && repeaterToolV != null)
            {
                // DRAW GRID
                Handles.color = new Color(1, .5f, 0, .4f);


                if (!beingDrawnFromConsumer)
                {
                    consumerM *= generator.parametricObject.getLocalMatrix().inverse;
                    consumerM *= parametricObject.getAxisRotationMatrix();
                }

                consumerM *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90, 0, 0), Vector3.one);

                //consumerM *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(90, 0, 0), Vector3.one);


                Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90, 0, 0), Vector3.one);

                Handles.matrix = context;

                for (int i = 0; i <= repeaterToolU.cells; i++)
                {
                    Handles.DrawLine(new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, -repeaterToolV.size / 2), new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, repeaterToolV.size / 2));
                }

                for (int k = 0; k <= repeaterToolV.cells; k++)
                {
                    Handles.DrawLine(new Vector3(-repeaterToolU.size / 2, 0, -repeaterToolV.size / 2 + k * repeaterToolV.actualBay), new Vector3(repeaterToolU.size / 2, 0, -repeaterToolV.size / 2 + k * repeaterToolV.actualBay));
                }


                // ASK RepeaterTools to DRAW
                GeneratorHandler gh = getGeneratorHandler(repeaterToolU.parametricObject);

                if (gh != null)
                {
                    Handles.matrix = context * Matrix4x4.TRS(new Vector3(0, 0, -1.3f * repeaterToolV.size / 2), Quaternion.Euler(90, 0, 0), Vector3.one);

                    gh.drawBoundsHandles(context, true);
                    gh.drawControlHandles(ref visited, consumerM, true);
                }
                gh = getGeneratorHandler(repeaterToolV.parametricObject);
                if (gh != null)
                {
                    Handles.matrix = context * Matrix4x4.TRS(new Vector3(1.3f * repeaterToolU.size / 2, 0, 0), Quaternion.Euler(90, -90, 0), Vector3.one);
                    gh.drawBoundsHandles(context, true);
                    gh.drawControlHandles(ref visited, consumerM, true);
                }
            }


            // MATRIX
            //Matrix4x4 inputsM = consumerM;

            //if (beingDrawnFromConsumer)
            //	inputsM *= generator.parametricObject.getLocalMatrix();

            drawControlHandlesofInputParametricObjects(ref visited, consumerM * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(90, 0, 0), Vector3.one), true);


            /*
             * // DRAW THE FINAL MERGED SHAPE
             *
             * if (! beingDrawnFromConsumer)
             *      consumerM *= generator.parametricObject.getLocalMatrix().inverse;
             *
             * AXShape inputShape = (parametricObject.generator as ShapeMerger).InputShape;
             * AXParameter out_p = inputShape.getSelectedOutputParameter();
             *
             *
             * if(! inputShape.hasOutputConnected())
             *      consumerM *= generator.parametricObject.getAxisRotationMatrix();
             *
             * Handles.matrix = generator.parametricObject.worldDisplayMatrix;;
             *
             * Color mergeShapeColor = Color.cyan;
             * mergeShapeColor.a *= .75f;
             * Handles.color = mergeShapeColor;
             *
             * drawPaths(out_p);
             */
            Handles.matrix = prevHandlesMatrix;
        }
        public override void drawControlHandles(ref List <string> visited, Matrix4x4 consumerM, bool beingDrawnFromConsumer)
        {
            if (alreadyVisited(ref visited, "LinearRepeater2DHandler"))
            {
                return;
            }

            Matrix4x4 prevHandlesMatrix = Handles.matrix;

            base.drawControlHandles(ref visited, consumerM, beingDrawnFromConsumer);


            RepeaterTool repeaterToolU = (parametricObject.generator as LinearRepeater2D).repeaterToolU;



            if (repeaterToolU != null)
            {
                // DRAW GRID
                Handles.color = new Color(1, .5f, 0, .4f);


                if (!beingDrawnFromConsumer)
                {
                    consumerM *= generator.parametricObject.getLocalMatrix().inverse;
                    consumerM *= parametricObject.getAxisRotationMatrix();
                }

                consumerM *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90, 0, 0), Vector3.one);

                //consumerM *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(90, 0, 0), Vector3.one);


                Matrix4x4 context = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90, 0, 0), Vector3.one);



                Handles.matrix = context;

                for (int i = 0; i <= repeaterToolU.cells; i++)
                {
                    Handles.DrawLine(new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, 0), new Vector3(-repeaterToolU.size / 2 + i * repeaterToolU.actualBay, 0, 0));
                }



                // ASK RepeaterTools to DRAW
                GeneratorHandler gh = getGeneratorHandler(repeaterToolU.parametricObject);

                if (gh != null)
                {
                    Handles.matrix = context * Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.Euler(90, 0, 0), Vector3.one);

                    gh.drawBoundsHandles(context, true);

                    //List<string> _visited = new List<string>();
                    gh.drawControlHandles(ref visited, consumerM, true);
                }
            }


            // MATRIX

            drawControlHandlesofInputParametricObjects(ref visited, consumerM * Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(-90, 0, 0), Vector3.one), true);

            Handles.matrix = prevHandlesMatrix;
        }