70 lines
2.4 KiB
ActionScript
70 lines
2.4 KiB
ActionScript
class PropertiesPanel : Panel {
|
|
float slider = 0;
|
|
vec3 slid;
|
|
vec3 slid2;
|
|
|
|
void render() {
|
|
Entity entity = ActiveEntity::getActiveEntity();
|
|
|
|
// NAME
|
|
// Id:0 [+ add component]
|
|
UI::title("\uf1b2 " + entity.name);
|
|
if (!entity.isRoot)
|
|
UI::contextItemPopup("##MenuOptions", SimpleFunction(this.renameEntityMenu));
|
|
UI::separator();
|
|
UI::textColor(0.5, 0.5, 0.5f, "Id : " + entity.id);
|
|
|
|
// We don't want to change root options
|
|
if (entity.isRoot)
|
|
return;
|
|
|
|
UI::sameline();
|
|
if (UI::buttonEnd("\uf055 Add Component")) {
|
|
UI::openPopup("ADD_COMPONENT", any(entity));
|
|
}
|
|
|
|
UI::space();
|
|
|
|
TransformPropertiesRender transformComponentRender(entity);
|
|
UI::componentNode("\uf0b2 Transform Component", SimpleFunction(transformComponentRender.renderTransformComponent));
|
|
|
|
if (entity.hasMeshComponent()) {
|
|
MeshComponentRender meshComponentRender(entity);
|
|
UI::componentNodeContextMenu("\uf248 Mesh Component", SimpleFunction(meshComponentRender.render), SimpleFunction(meshComponentRender.remove));
|
|
}
|
|
|
|
if (entity.hasShaderComponent()) {
|
|
ShaderComponentRender shaderComponentRender(entity);
|
|
UI::componentNodeContextMenu("\uf248 Shader Component", SimpleFunction(shaderComponentRender.render), SimpleFunction(shaderComponentRender.remove));
|
|
}
|
|
|
|
if (entity.hasCameraComponent()) {
|
|
CameraComponentRender cameraComponentRender(entity);
|
|
UI::componentNodeContextMenu("\uf030 Camera Component", SimpleFunction(cameraComponentRender.render), SimpleFunction(cameraComponentRender.remove));
|
|
}
|
|
|
|
UI::space();
|
|
|
|
UI::separator();
|
|
|
|
if (UI::buttonCenter("\uf055 Add Component##2")) {
|
|
UI::openPopup("ADD_COMPONENT", any(entity));
|
|
}
|
|
|
|
AddComponentRender addComponentRender(entity);
|
|
UI::simplePopup("ADD_COMPONENT", SimpleFunction(addComponentRender.addComponentPopup));
|
|
UI::modalPopup("Rename entity", SimpleFunction(this.renameEntityMenu));
|
|
}
|
|
|
|
void renameEntityMenu() {
|
|
Entity entity = ActiveEntity::getActiveEntity();
|
|
|
|
if (!entity.isRoot) {
|
|
if (UI::menuItem("Rename")) {
|
|
UI::openPopup("Rename entity", any(entity));
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|