/* * [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; } }
/* * [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); } } }
/* * [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); } } }
/* * [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 drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false) { base.drawBoundsHandles(consumerM, forceDraw); RepeaterTool repeaterTool = generator as RepeaterTool; Matrix4x4 prevHandlesMatrix = Handles.matrix; float width = repeaterTool.bay / 3; float thick = .5f; float alpha = .3f; Handles.matrix = consumerM; // * consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix() ; Color prevColor = Handles.color; Handles.color = new Color(1, .5f, 0); Handles.DrawLine(new Vector3(-repeaterTool.size / 2, 0, 0), new Vector3(repeaterTool.size / 2, 0, 0)); Handles.color = new Color(1, .5f, 0, alpha); Handles.DrawLine(new Vector3(-repeaterTool.size / 2, 0, thick), new Vector3(repeaterTool.size / 2, 0, thick)); Handles.DrawLine(new Vector3(-repeaterTool.size / 2, 0, -thick), new Vector3(repeaterTool.size / 2, 0, -thick)); float cursor = -repeaterTool.size / 2; for (int i = 0; i <= repeaterTool.cells; i++) { Handles.color = new Color(1, .5f, 0); Handles.DrawLine(new Vector3(cursor, 0, -width), new Vector3(cursor, 0, width)); Handles.color = new Color(1, .5f, 0, alpha); Handles.DrawLine(new Vector3(cursor + thick, 0, -width), new Vector3(cursor + thick, 0, width)); Handles.DrawLine(new Vector3(cursor - thick, 0, -width), new Vector3(cursor - thick, 0, width)); cursor += repeaterTool.actualBay; } bool isEven = (repeaterTool.cells % 2 == 0); isEven = false; // Dimension Lines float handleSize = .15f * HandleUtility.GetHandleSize(Vector3.zero); float hgtSpan = handleSize * 8f; hgtSpan = Mathf.Clamp(hgtSpan, .25f, 100); float hgtBay = hgtSpan * .5f; float lhgtBay = hgtBay * .75f; float lhgtSpan = hgtSpan * .75f; float hgt = hgtBay; float lhgt = lhgtBay; float left = (isEven) ? 0 : -repeaterTool.actualBay / 2; float right = (isEven) ? repeaterTool.actualBay : repeaterTool.actualBay / 2; float len = .05f; Vector3 pos = new Vector3(right, -lhgt, 0); Handles.color = new Color(1, 1f, .5f, alpha); Handles.DrawLine(new Vector3(left, 0, 0), new Vector3(left, -hgt, 0)); Handles.DrawLine(new Vector3(right, 0, 0), new Vector3(right, -hgt, 0)); Handles.DrawLine(new Vector3(left, -lhgt, 0), new Vector3(right, -lhgt, 0)); Handles.DrawLine(new Vector3(right + len, -lhgt - len, 0), new Vector3(right - len, -lhgt + len, 0)); Handles.DrawLine(new Vector3(left + len, -lhgt - len, 0), new Vector3(left - len, -lhgt + len, 0)); Handles.Label(new Vector3((isEven) ? repeaterTool.bay / 2 : 0, -lhgt * 1.1f, 0), "" + System.Math.Round(repeaterTool.actualBay, 2), ArchimatixEngine.sceneViewLabelStyle); //EditorGUI. Handles.color = new Color(1, .5f, 0, .9f); EditorGUI.BeginChangeCheck(); pos = Handles.FreeMoveHandle( pos, Quaternion.identity, handleSize, Vector3.zero, Handles.SphereCap ); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Bay Size"); repeaterTool.P_Bay.initiateRipple_setFloatValueFromGUIChange(((isEven) ? pos.x : pos.x + repeaterTool.bay / 2)); repeaterTool.parametricObject.model.isAltered(25); } // SIZE DIMENSION LINE hgt = hgtSpan; lhgt = lhgtSpan; left = -repeaterTool.size / 2; right = repeaterTool.size / 2; Handles.color = new Color(1, 1f, .5f, alpha); Handles.DrawLine(new Vector3(left, 0, 0), new Vector3(left, -hgt, 0)); Handles.DrawLine(new Vector3(right, 0, 0), new Vector3(right, -hgt, 0)); Handles.DrawLine(new Vector3(left, -lhgt, 0), new Vector3(right, -lhgt, 0)); Handles.DrawLine(new Vector3(right + len, -lhgt - len, 0), new Vector3(right - len, -lhgt + len, 0)); Handles.DrawLine(new Vector3(left + len, -lhgt - len, 0), new Vector3(left - len, -lhgt + len, 0)); Handles.Label(new Vector3((isEven) ? repeaterTool.bay / 2 : 0, -lhgt * 1.1f, 0), "" + System.Math.Round(repeaterTool.size, 2), ArchimatixEngine.sceneViewLabelStyle); pos = new Vector3(right, -lhgt, 0); Handles.color = new Color(1, .5f, 0, .9f); EditorGUI.BeginChangeCheck(); pos = Handles.FreeMoveHandle( pos, Quaternion.identity, .15f * HandleUtility.GetHandleSize(pos), Vector3.zero, Handles.SphereCap ); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Size"); repeaterTool.parametricObject.getParameter("Size").initiateRipple_setFloatValueFromGUIChange(pos.x * 2); repeaterTool.parametricObject.model.isAltered(26); } pos = new Vector3(right - handleSize * 1f, -lhgtBay, 0); if (Handles.Button(pos, Quaternion.Euler(0, -90, 0), .15f * HandleUtility.GetHandleSize(pos), .15f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Cell Count"); repeaterTool.parametricObject.getParameter("Cells").initiateRipple_setIntValueFromGUIChange(repeaterTool.parametricObject.intValue("Cells") - 1); repeaterTool.parametricObject.model.autobuild(); } pos = new Vector3(left + handleSize * 1f, -lhgtBay, 0); if (Handles.Button(pos, Quaternion.Euler(0, 90, 0), .15f * HandleUtility.GetHandleSize(pos), .15f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Cell Count"); repeaterTool.parametricObject.getParameter("Cells").initiateRipple_setIntValueFromGUIChange(repeaterTool.parametricObject.intValue("Cells") + 1); repeaterTool.parametricObject.model.autobuild(); } Handles.matrix = prevHandlesMatrix; Handles.color = prevColor; }
public override void drawBoundsHandles(Matrix4x4 consumerM, bool forceDraw = false) { //base.drawBoundsHandles(consumerM, forceDraw); RepeaterTool repeaterToolU = generator as RepeaterTool; Matrix4x4 prevHandlesMatrix = Handles.matrix; float width = repeaterToolU.bay / 3; float thick = .1f; float alpha = .3f; //Handles.matrix = consumerM; // * consumerM * parametricObject.getAxisRotationMatrix() * parametricObject.getLocalAlignMatrix() ; Color prevColor = Handles.color; Handles.color = new Color(1, .5f, 0); Handles.DrawLine(new Vector3(-repeaterToolU.size / 2, 0, 0), new Vector3(repeaterToolU.size / 2, 0, 0)); Handles.color = new Color(1, .5f, 0, alpha); Handles.DrawLine(new Vector3(-repeaterToolU.size / 2, 0, thick), new Vector3(repeaterToolU.size / 2, 0, thick)); Handles.DrawLine(new Vector3(-repeaterToolU.size / 2, 0, -thick), new Vector3(repeaterToolU.size / 2, 0, -thick)); float cursor = -repeaterToolU.size / 2; for (int i = 0; i <= repeaterToolU.cells; i++) { Handles.color = new Color(1, .5f, 0); Handles.DrawLine(new Vector3(cursor, 0, -width), new Vector3(cursor, 0, width)); Handles.color = new Color(1, .5f, 0, alpha); Handles.DrawLine(new Vector3(cursor + thick, 0, -width), new Vector3(cursor + thick, 0, width)); Handles.DrawLine(new Vector3(cursor - thick, 0, -width), new Vector3(cursor - thick, 0, width)); cursor += repeaterToolU.actualBay; } bool isEven = (repeaterToolU.cells % 2 == 0); isEven = false; GUIStyle labelStyle = new GUIStyle(); labelStyle.alignment = TextAnchor.MiddleCenter; labelStyle.normal.textColor = Color.white; // Dimension Lines float handleSize = .15f * HandleUtility.GetHandleSize(Vector3.zero); float hgtSpan = handleSize * 8f; hgtSpan = Mathf.Clamp(hgtSpan, .25f, 100); float hgtBay = hgtSpan * .5f; float lhgtBay = hgtBay * .75f; float lhgtSpan = hgtSpan * .75f; float hgt = hgtBay; float lhgt = lhgtBay; float left = (isEven) ? 0 : -repeaterToolU.actualBay / 2; float right = (isEven) ? repeaterToolU.actualBay : repeaterToolU.actualBay / 2; float len = .05f; Vector3 pos = new Vector3(right, -lhgt, 0); Handles.color = new Color(1, 1f, .5f, alpha); Handles.DrawLine(new Vector3(left, 0, 0), new Vector3(left, -hgt, 0)); Handles.DrawLine(new Vector3(right, 0, 0), new Vector3(right, -hgt, 0)); Handles.DrawLine(new Vector3(left, -lhgt, 0), new Vector3(right, -lhgt, 0)); Handles.DrawLine(new Vector3(right + len, -lhgt - len, 0), new Vector3(right - len, -lhgt + len, 0)); Handles.DrawLine(new Vector3(left + len, -lhgt - len, 0), new Vector3(left - len, -lhgt + len, 0)); Handles.Label(new Vector3((isEven) ? -.25f * repeaterToolU.bay : .25f * repeaterToolU.bay, -lhgt * 1.1f, 0), "" + System.Math.Round(repeaterToolU.actualBay, 2), labelStyle); //EditorGUI. // BAY_SIZE Handles.color = new Color(1, .5f, .5f, .3f); EditorGUI.BeginChangeCheck(); pos = Handles.FreeMoveHandle( pos, Quaternion.identity, handleSize, Vector3.zero, Handles.SphereCap ); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Bay Size"); repeaterToolU.P_Bay.initiateRipple_setFloatValueFromGUIChange(((isEven) ? pos.x : pos.x + repeaterToolU.bay / 2)); repeaterToolU.parametricObject.model.isAltered(22); if (generator.P_Output != null && generator.P_Output.Dependents != null) { for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } } // SIZE DIMENSION LINE hgt = hgtSpan; lhgt = lhgtSpan; left = -repeaterToolU.size / 2; right = repeaterToolU.size / 2; Handles.color = new Color(1, 1f, .5f, alpha); Handles.DrawLine(new Vector3(left, 0, 0), new Vector3(left, -hgt, 0)); Handles.DrawLine(new Vector3(right, 0, 0), new Vector3(right, -hgt, 0)); Handles.DrawLine(new Vector3(left, -lhgt, 0), new Vector3(right, -lhgt, 0)); Handles.DrawLine(new Vector3(right + len, -lhgt - len, 0), new Vector3(right - len, -lhgt + len, 0)); Handles.DrawLine(new Vector3(left + len, -lhgt - len, 0), new Vector3(left - len, -lhgt + len, 0)); Handles.Label(new Vector3((isEven) ? -.25f * repeaterToolU.size : -.25f * repeaterToolU.size, -lhgt * 1.1f, 0), "" + System.Math.Round(repeaterToolU.size, 2), labelStyle); // SIZE (RIGHT) pos = new Vector3(right, -lhgt, 0); Handles.color = new Color(1, .5f, 0, .9f); EditorGUI.BeginChangeCheck(); pos = Handles.FreeMoveHandle( pos, Quaternion.identity, .15f * HandleUtility.GetHandleSize(pos), Vector3.zero, Handles.SphereCap ); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Size"); //.parametricObject.setAltered(); repeaterToolU.parametricObject.getParameter("Size").initiateRipple_setFloatValueFromGUIChange(pos.x * 2); repeaterToolU.parametricObject.model.isAltered(23); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } // SIZE (LEFT) pos = new Vector3(left, -lhgt, 0); Handles.color = new Color(1, .5f, 0, .9f); EditorGUI.BeginChangeCheck(); pos = Handles.FreeMoveHandle( pos, Quaternion.identity, .15f * HandleUtility.GetHandleSize(pos), Vector3.zero, Handles.SphereCap ); if (EditorGUI.EndChangeCheck()) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Size"); //repeaterToolU.parametricObject.setAltered(); repeaterToolU.parametricObject.getParameter("Size").initiateRipple_setFloatValueFromGUIChange(-pos.x * 2); repeaterToolU.parametricObject.model.isAltered(24); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } // CELL_COUNT CLICKERS // (-) Handles.color = new Color(.7f, .7f, 1, .9f); pos = new Vector3(left - handleSize * 1f, -lhgtBay, 0); if (Handles.Button(pos, Quaternion.Euler(0, -90, 0), .15f * HandleUtility.GetHandleSize(pos), .15f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Cell Count"); repeaterToolU.parametricObject.getParameter("Cells").initiateRipple_setIntValueFromGUIChange(repeaterToolU.parametricObject.intValue("Cells") - 1); repeaterToolU.parametricObject.model.autobuild(); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } // [+] Handles.color = new Color(.7f, 1f, .7f, .9f); pos = new Vector3(left + handleSize * 1f, -lhgtBay, 0); if (Handles.Button(pos, Quaternion.Euler(0, 90, 0), .15f * HandleUtility.GetHandleSize(pos), .15f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Cell Count"); repeaterToolU.parametricObject.getParameter("Cells").initiateRipple_setIntValueFromGUIChange(repeaterToolU.parametricObject.intValue("Cells") + 1); repeaterToolU.parametricObject.model.autobuild(); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } Handles.Label(new Vector3(left, -lhgtBay, 0), "" + (repeaterToolU.cells), labelStyle); // EDGE_COUNT CLICKERS // (-) if (repeaterToolU.edgeCount < 90) { Handles.color = new Color(.7f, .7f, 1, .6f); pos = new Vector3(left - handleSize * 1f, -lhgtBay / 2, 0); if (Handles.Button(pos, Quaternion.Euler(0, -90, 0), .13f * HandleUtility.GetHandleSize(pos), .13f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Edge Count"); repeaterToolU.parametricObject.getParameter("Edge_Count").initiateRipple_setIntValueFromGUIChange(repeaterToolU.parametricObject.intValue("Edge_Count") - 1); repeaterToolU.parametricObject.model.autobuild(); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } // [+] Handles.color = new Color(.7f, 1f, .7f, .6f); pos = new Vector3(left + handleSize * 1f, -lhgtBay / 2, 0); if (Handles.Button(pos, Quaternion.Euler(0, 90, 0), .13f * HandleUtility.GetHandleSize(pos), .13f * HandleUtility.GetHandleSize(pos), Handles.ConeCap)) { Undo.RegisterCompleteObjectUndo(parametricObject.model, "Edge Count"); repeaterToolU.parametricObject.getParameter("Edge_Count").initiateRipple_setIntValueFromGUIChange(repeaterToolU.parametricObject.intValue("Edge_Count") + 1); repeaterToolU.parametricObject.model.autobuild(); for (int i = 0; i < generator.P_Output.Dependents.Count; i++) { generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices(); } } Handles.Label(new Vector3(left, -lhgtBay / 2, 0), "" + (repeaterToolU.edgeCount), labelStyle); } Handles.matrix = prevHandlesMatrix; Handles.color = prevColor; }
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; }