Skip to content

Commit

Permalink
refactored console output to Debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
JirkaDellOro committed Oct 2, 2024
1 parent 4fe7849 commit 8891a0a
Show file tree
Hide file tree
Showing 31 changed files with 120 additions and 116 deletions.
4 changes: 2 additions & 2 deletions Distribution/FudgeAid.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Distribution/FudgeCore.js

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions Distribution/FudgeUserInterface.js

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions Editor/Build/Fudge/Fudge.js

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions Editor/Build/Main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ declare namespace Fudge {
REMOVE_COMPONENT = 14,
ADD_JOINT = 15,
DELETE_RESOURCE = 16,
ORTHGRAPHIC_CAMERA = 17,
RENDER_CONTINUOUSLY = 18,
ADD_PROPERTY = 19,
DELETE_PROPERTY = 20,
CONVERT_ANIMATION = 21,
ADD_PARTICLE_PROPERTY = 22,
ADD_PARTICLE_FUNCTION = 23,
ADD_PARTICLE_CONSTANT = 24,
ADD_PARTICLE_CODE = 25,
ADD_PARTICLE_TRANSFORMATION = 26,
DELETE_PARTICLE_DATA = 27
CLONE_RESOURCE = 17,
ORTHGRAPHIC_CAMERA = 18,
RENDER_CONTINUOUSLY = 19,
ADD_PROPERTY = 20,
DELETE_PROPERTY = 21,
CONVERT_ANIMATION = 22,
ADD_PARTICLE_PROPERTY = 23,
ADD_PARTICLE_FUNCTION = 24,
ADD_PARTICLE_CONSTANT = 25,
ADD_PARTICLE_CODE = 26,
ADD_PARTICLE_TRANSFORMATION = 27,
DELETE_PARTICLE_DATA = 28
}
enum MENU {
QUIT = "quit",
Expand Down Expand Up @@ -65,12 +66,12 @@ declare namespace Fudge {
PARTICLE_SYSTEM = "ViewParticleSystem"
}
enum TRANSFORM {
NONE = "none",
TRANSLATE = "translate",
ROTATE = "rotate",
SCALE = "scale"
}
enum GIZMOS {
TRANSFORM = "Transform"
SCALE = "scale",
WORLD = "world",
LOCAL = "local"
}
}
/**
Expand Down
32 changes: 16 additions & 16 deletions Editor/Build/Main.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Script {
case ƒ.EVENT.NODE_DESERIALIZED:
// if deserialized the node is now fully reconstructed and access to all its components and children is possible
let cmpRigidbody: ƒ.ComponentRigidbody = this.node.getComponent(ƒ.ComponentRigidbody);
console.log(cmpRigidbody);
ƒ.Debug.log(cmpRigidbody);
cmpRigidbody.setVelocity(ƒ.Vector3.Z(this.velocity));
break;
}
Expand Down
6 changes: 3 additions & 3 deletions Editor/Source/Fudge/Controller/ControllerDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ namespace Fudge {
}

private hndInsert = (_event: CustomEvent): void => {
console.log("INSERT at ControllerDetail");
console.log(_event.detail);
ƒ.Debug.log("INSERT at ControllerDetail");
ƒ.Debug.log(_event.detail);
let mutable: ƒ.Mutable = this.mutable[_event.detail.getAttribute("key")];
console.log(mutable.type);
ƒ.Debug.log(mutable.type);
if (mutable instanceof ƒ.MutableArray)
mutable.push(new mutable.type());
};
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Fudge/Controller/ControllerTableResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace Fudge {
}

public async delete(_focussed: ƒ.SerializableResource[]): Promise<ƒ.SerializableResource[]> {
console.log(_focussed, this.selection);
// ƒ.Debug.info(_focussed, this.selection);
// this.selection = [];
let expendables: ƒ.SerializableResource[] = this.selection.slice(); //_focussed);
if (expendables.length == 0)
Expand Down
4 changes: 2 additions & 2 deletions Editor/Source/Fudge/FileIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ namespace Fudge {
return;

let base: URL = new URL(new URL("file://" + filename[0]).toString() + "/");
console.log("Path", base.toString());
ƒ.Debug.log("Path", base.toString());

project = new Project(base);

await saveProject(true);

let ƒPath: URL = new URL("../../", location.href);
console.log(ƒPath);
ƒ.Debug.log(ƒPath);

fs.copyFileSync(new URL("Editor/Source/Template/.gitignore.txt", ƒPath), new URL(".gitignore", base));
fs.mkdirSync(new URL("Script/Source", base), { recursive: true });
Expand Down
7 changes: 3 additions & 4 deletions Editor/Source/Fudge/History.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,17 @@ namespace Fudge {
* Print the current history to the console
*/
public static print(): void {
console.group("History");
console.log("Pointer: ", History.#pointer);
ƒ.Debug.info("Current History -----------------------------------");
ƒ.Debug.info("Pointer: ", History.#pointer);
History.#steps.forEach((_step, _i) =>
console.log(
ƒ.Debug.info(
_i + (History.#pointer - 1 == _i ? "->" : " "),
HISTORY[_step[0]],
_step[1].constructor.name,
_step[2] instanceof ƒ.Mutable || _step[2] instanceof ƒ.Node ?
_step[2].constructor.name :
_step[2]
));
console.groupEnd();
};

/**
Expand Down
6 changes: 3 additions & 3 deletions Editor/Source/Fudge/Page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Fudge {
private static physics: { [idGraph: string]: ƒ.Physics } = {};

public static setDefaultProject(): void {
console.log("Set default project in local storage", project);
ƒ.Debug.log("Set default project in local storage", project);
if (project)
localStorage.setItem("project", project.base.toString());
}
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace Fudge {
private static async start(): Promise<void> {
// ƒ.Debug.setFilter(ƒ.DebugConsole, ƒ.DEBUG_FILTER.ALL | ƒ.DEBUG_FILTER.SOURCE);

console.log("LocalStorage", localStorage);
ƒ.Debug.log("LocalStorage", localStorage);

Page.setupGoldenLayout();
ƒ.Project.mode = ƒ.MODE.EDITOR;
Expand All @@ -78,7 +78,7 @@ namespace Fudge {
ipcRenderer.send("enableMenuItem", { item: Fudge.MENU.PANEL_HELP_OPEN, on: true });

if (localStorage.project) {
console.log("Load project referenced in local storage", localStorage.project);
ƒ.Debug.log("Load project referenced in local storage", localStorage.project);
await Page.loadProject(new URL(localStorage.project));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Fudge/Panel/PanelHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Fudge {
public constructor(_container: ComponentContainer, _state: ViewState) {
super(_container, _state);
this.setTitle("Help");
console.log(this.dom);
ƒ.Debug.log(this.dom);
// TODO: iframe sandbox disallows use of scripts, remove or replace with object if necessary
// this.dom.innerHTML = `<iframe src="Help.html" sandbox></iframe>`;
this.dom.innerHTML = `<object data="Help.html"></object>`;
Expand Down
6 changes: 3 additions & 3 deletions Editor/Source/Fudge/Project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace Fudge {

public hndChange = (_event: Event): void => {
let mutator: ƒ.Mutator = ƒui.Controller.getMutator(this, ƒui.Dialog.dom, this.getMutator());
console.log(mutator, this);
ƒ.Debug.info(mutator, this);
};

public async load(_htmlContent: string): Promise<void> {
Expand All @@ -73,8 +73,8 @@ namespace Fudge {
let url: string = script.getAttribute("src");
ƒ.Debug.fudge("Load script: ", url);
await ƒ.Project.loadScript(new URL(url, this.base).toString());
console.log("ComponentScripts", ƒ.Project.getComponentScripts());
console.log("Script Namespaces", ƒ.Project.scriptNamespaces);
ƒ.Debug.log("ComponentScripts", ƒ.Project.getComponentScripts());
ƒ.Debug.log("Script Namespaces", ƒ.Project.scriptNamespaces);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Fudge/View/Animation/ViewAnimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace Fudge {
case CONTEXTMENU.CONVERT_ANIMATION:
if (this.animation instanceof ƒ.AnimationSprite) {
let animation: ƒ.Animation = this.animation.convertToAnimation();
console.log(animation);
ƒ.Debug.log(animation);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Fudge/View/Graph/ViewComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace Fudge {
if (element.tagName == "BODY")
return;
do {
console.log(element.tagName);
ƒ.Debug.info(element.tagName);
let controller: ControllerDetail = Reflect.get(element, "controller");
if (element.tagName == "DETAILS" && controller) {
this.dispatch(EVENT_EDITOR.DELETE, { detail: { mutable: <ƒ.Mutable>controller.getMutable() } });
Expand Down
2 changes: 1 addition & 1 deletion Editor/Source/Fudge/View/Project/ViewInternalFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace Fudge {
focus = focus.resourceParent;
}

console.log(focus.name);
ƒ.Debug.info(focus.name);
if (!(focus instanceof ResourceFolder))
return;

Expand Down
2 changes: 1 addition & 1 deletion Source/Aid/Viewport/Viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace FudgeAid {
let cntFly: ƒ.Control = new ƒ.Control("Fly", flySpeed);
cntFly.setDelay(500);
let flying: boolean = false;
console.log(timer);
ƒ.Debug.log(timer);

let touchState: "orbit" | "fly" | "zoom";

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Graph/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace FudgeCore {
Project.register(this, _serialization.idResource);
await Project.resyncGraphInstances(this);
this.broadcastEvent(new Event(EVENT.GRAPH_DESERIALIZED));
console.log("Deserialized", this.name);
Debug.log("Deserialized", this.name);
return this;
}

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Graph/GraphInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace FudgeCore {
await this.connectToGraph(); // otherwise just connect
// }
else {
console.log("Register for resync", _serialization.name, this.name);
Debug.log("Register for resync", _serialization.name, this.name);
Project.registerGraphInstanceForResync(this);
}
return this;
Expand Down Expand Up @@ -125,7 +125,7 @@ namespace FudgeCore {
break;
}

console.log(this.name + GraphInstance.count++);
Debug.log(this.name + GraphInstance.count++);

// graph.addEventListener(EVENT.MUTATE, (_event: CustomEvent) => this.hndMutation, true);
_graph.addEventListener(EVENT.MUTATE_GRAPH, this.hndMutationGraph);
Expand All @@ -134,7 +134,7 @@ namespace FudgeCore {
// graph.addEventListener(EVENT.MUTATE_GRAPH_DONE, () => { console.log("Done", this.name); /* this.#sync = true; */ });

//@ts-ignore
console.log(_graph?.listeners);
Debug.log(_graph?.listeners);
this.broadcastEvent(new Event(EVENT.GRAPH_INSTANTIATED));
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Render/RenderInjectorShader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace FudgeCore {
crc3.compileShader(webGLShader);
let error: string = RenderWebGL.assert<string>(crc3.getShaderInfoLog(webGLShader));
if (error !== "") {
console.log(_shaderCode);
Debug.log(_shaderCode);

throw new Error("Error compiling shader: " + error);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Serialization/FBX/FBXLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ namespace FudgeCore {
public constructor(_buffer: ArrayBuffer, _uri: string) {
this.uri = _uri;
this.nodes = FBX.parseNodesFromBinary(_buffer);
console.log(this.nodes);
Debug.log(this.nodes);
this.fbx = FBX.loadFromNodes(this.nodes);
console.log(this.fbx);
Debug.log(this.fbx);
}

private static get defaultMaterial(): Material {
Expand Down
10 changes: 5 additions & 5 deletions Source/Net/Client/FudgeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace FudgeNet {
return;
peer.close();
delete this.peers[_idRemote];
console.log("Deleted peer", _idRemote, "remaining", this.peers);
ƒ.Debug.log("Deleted peer", _idRemote, "remaining", this.peers);
}

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ namespace FudgeNet {
this.sendToAllPeers(message);
}
} catch (_error) {
console.log(_error);
ƒ.Debug.log(_error);
}
}

Expand All @@ -137,7 +137,7 @@ namespace FudgeNet {
public becomeHost(): void {
this.dispatch({ idRoom: idRoom, command: FudgeNet.COMMAND.DISCONNECT_PEERS });
this.disconnectPeers();
console.log("createHost", this.id);
ƒ.Debug.log("createHost", this.id);
this.dispatch({ idRoom: idRoom, command: FudgeNet.COMMAND.CONNECT_HOST, route: FudgeNet.ROUTE.SERVER });
}

Expand Down Expand Up @@ -186,7 +186,7 @@ namespace FudgeNet {
host = id;
if (host != this.idHost) {
this.idHost = host;
console.log("New host", host);
ƒ.Debug.log("New host", host);
}
break;
}
Expand Down Expand Up @@ -266,7 +266,7 @@ namespace FudgeNet {

rtc.addEventListener(
"icegatheringstatechange", (_event: Event) => {
console.log("ICE-state", rtc.iceGatheringState);
ƒ.Debug.log("ICE-state", rtc.iceGatheringState);
}
);

Expand Down
2 changes: 1 addition & 1 deletion Source/UserInterface/Controller/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ namespace FudgeUserInterface {

// get current mutator and save for undo
let mutator: ƒ.Mutator = this.mutable.getMutator();
console.log(mutator);
// ƒ.Debug.info(mutator);
this.domElement.dispatchEvent(new CustomEvent(EVENT.SAVE_HISTORY, {bubbles: true, detail: {mutable: this.mutable, mutator: ƒ.Mutable.getMutatorFromPath(mutator, path)
}}));

Expand Down
2 changes: 1 addition & 1 deletion Source/UserInterface/Controller/Generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace FudgeUserInterface {
// @ts-ignore: instantiate abstract class
element = new elementType({ key: _key, label: _key, value: _value.toString() }, _type);
} else if (_value instanceof ƒ.MutableArray) { // TODO: delete?
console.log("MutableArray");
ƒ.Debug.info("MutableArray");
// insert Array-Controller!
} else {
let elementType: typeof CustomElement = CustomElement.get(_type);
Expand Down
2 changes: 1 addition & 1 deletion Source/UserInterface/CustomElement/CustomElementStepper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ namespace FudgeUserInterface {
if (digit == this.querySelector("[name=exp]")) {
// console.log(this.value);
let value: number = this.value * Math.pow(10, _amount);
console.log(value, this.value);
ƒ.Debug.log(value, this.value);
if (isFinite(value))
this.value = value;
this.display();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace FudgeUserInterface {
for (let key in _mutator) {
let element: HTMLInputElement = this.querySelector(`[key="${key}"]`);
if (!element)
console.log(`Couldn't find ${key} in`, this);
ƒ.Debug.log(`Couldn't find ${key} in`, this);
if (element instanceof CustomElement)
element.setMutatorValue(_mutator[key]);
else
Expand Down
2 changes: 1 addition & 1 deletion Source/UserInterface/CustomElement/Details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace FudgeUserInterface {

switch (_event.code) {
case ƒ.KEYBOARD_CODE.INSERT:
console.log("INSERT at Details");
ƒ.Debug.log("INSERT at Details");
this.dispatchEvent(new CustomEvent(EVENT.INSERT, { bubbles: true, detail: this }));
break;
case ƒ.KEYBOARD_CODE.DELETE:
Expand Down
4 changes: 2 additions & 2 deletions Source/UserInterface/CustomElement/DetailsArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace FudgeUserInterface {
child.setAttribute("key", count.toString());
if (child.setLabel)
child.setLabel(count.toString());
console.log(child.tabIndex);
ƒ.Debug.info(child.tabIndex);
count++;
}

Expand Down Expand Up @@ -113,7 +113,7 @@ namespace FudgeUserInterface {


private hndInsert = (_event: Event): void => {
console.log("hndInsert");
ƒ.Debug.info("hndInsert");
};

private hndKeySpecial = (_event: KeyboardEvent): void => {
Expand Down
3 changes: 2 additions & 1 deletion Source/UserInterface/CustomElement/Table/Table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace FudgeUserInterface {
import ƒ = FudgeCore;

// TODO: duplicated code in Table and Tree, may be optimized...

Expand Down Expand Up @@ -189,7 +190,7 @@ namespace FudgeUserInterface {
};

private hndCopyPaste = async (_event: ClipboardEvent): Promise<void> => {
console.log(_event);
ƒ.Debug.info(_event);
// _event.stopPropagation();

switch (_event.type) {
Expand Down
Loading

0 comments on commit 8891a0a

Please sign in to comment.