use of com.talosvfx.talos.editor.addons.scene.logic.components.AComponent in project talos by rockbite.
the class SceneEditorWorkspace method notifyAssetPathChanged.
private void notifyAssetPathChanged(Array<AComponent> list, GameObject gameObject, AssetPathChanged event) {
Iterable<AComponent> components = gameObject.getComponents();
for (AComponent component : components) {
boolean affected = component.notifyAssetPathChanged(event.oldRelativePath, event.newRelativePath);
if (affected) {
list.add(component);
}
}
Array<GameObject> gameObjects = gameObject.getGameObjects();
if (gameObjects != null) {
for (GameObject child : gameObjects) {
notifyAssetPathChanged(list, child, event);
}
}
}
use of com.talosvfx.talos.editor.addons.scene.logic.components.AComponent in project talos by rockbite.
the class SceneEditorWorkspace method initComponentsFromTemplate.
private void initComponentsFromTemplate(GameObject gameObject, XmlReader.Element template) {
XmlReader.Element container = template.getChildByName("components");
Array<XmlReader.Element> componentsXMLArray = container.getChildrenByName("component");
for (XmlReader.Element componentXML : componentsXMLArray) {
String className = componentXML.getAttribute("className");
String classPath = templateListPopup.componentClassPath;
try {
Class clazz = ClassReflection.forName(classPath + "." + className);
Object instance = ClassReflection.newInstance(clazz);
AComponent component = (AComponent) instance;
gameObject.addComponent(component);
} catch (Exception e) {
}
}
}
use of com.talosvfx.talos.editor.addons.scene.logic.components.AComponent in project talos by rockbite.
the class SceneEditorWorkspace method makeGizmosFor.
private void makeGizmosFor(GameObject gameObject) {
if (gizmoMap.containsKey(gameObject))
return;
Iterable<AComponent> components = gameObject.getComponents();
for (AComponent component : components) {
Array<Gizmo> gizmos = GizmoRegister.makeGizmosFor(component);
for (Gizmo gizmo : gizmos) {
if (gizmo != null) {
gizmo.setGameObject(gameObject);
Array<Gizmo> list = gizmoMap.get(gameObject);
if (list == null)
list = new Array<>();
gizmoMap.put(gameObject, list);
if (gizmo != null) {
gizmoList.add(gizmo);
list.add(gizmo);
}
}
}
}
}
use of com.talosvfx.talos.editor.addons.scene.logic.components.AComponent in project talos by rockbite.
the class SceneEditorWorkspace method onComponentUpdated.
@EventHandler
public void onComponentUpdated(ComponentUpdated event) {
AComponent component = event.getComponent();
sceneEditorAddon.propertyPanel.propertyProviderUpdated(component);
if (!event.wasRapid()) {
TalosMain.Instance().ProjectController().setDirty();
}
}
use of com.talosvfx.talos.editor.addons.scene.logic.components.AComponent in project talos by rockbite.
the class GameObject method write.
@Override
public void write(Json json) {
json.writeValue("name", name);
json.writeArrayStart("components");
for (AComponent component : components) {
json.writeValue(component, AComponent.class);
}
json.writeArrayEnd();
if (children != null) {
json.writeArrayStart("children");
for (GameObject child : children) {
json.writeValue(child, GameObject.class);
}
json.writeArrayEnd();
}
}
Aggregations