Skip to content

Commit

Permalink
Release v0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AchimStremplat committed Dec 16, 2021
1 parent e8b25c0 commit 1a1f2dc
Show file tree
Hide file tree
Showing 99 changed files with 3,261 additions and 992 deletions.
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,46 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
<!--- Template for next release section
## [unreleased]
* **File version number has changed. Files saved with RaCo X.Y.Z cannot be opened by previous versions.**
* **Export file format has changed. Scenes exported with RaCo X.Y.Z / ramses-logic A.B.C cannot be opened by previous ramses-logic versions.**
### Added
### Changes
### Fixes
### Known Bugs
### Known Issues
-->

## [0.11.0] Lua Modules
* **File version number has changed. Files saved with RaCo 0.11.0 cannot be opened by previous versions.**
* **Export file format has changed. Scenes exported with RaCo 0.11.0 / ramses-logic 0.13.0 cannot be opened by previous ramses-logic versions.**

### Added
* Added multi-selection for deleting, copying, cutting and pasting in Scene Graph, Resources, Prefabs and Project Browser.
* Added Lua module support.
* The new user type LuaScriptModule is a resource that loads modules from specified Lua files.
* LuaScripts have a new output entry "Modules" - for each module defined in the Lua script file, this entry will contain a reference drop-down where LuaScriptModules can be selected
* Nested modules are currently not supported.
* Added support for generating mipmaps for a textures.
* The texture object has a new option "Generate Mipmaps" which by default is off. If enabled, Ramses will auto-generate mipmaps for the texture.

### Changes
* Update from ramses-logic 0.12.0 to ramses-logic 0.13.0
* Major performance improvement for large scenes with lots of links alongside few bugfixes
* Update from ramses 27.0.113 to 27.0.114

### Fixes
* Undo / Redo is now properly working for collapsed vector editors in the property browser.
* Fixed visual issue with number inputs in property editor not leaving highlighted state after pressing enter.
* Fixed undo/redo to prevent creation of valid links starting on non-existing properties.
* Fixed drop down boxes with "<empty>" reference in property browser causing a crash when being deactivated.

### Known Issues
* The INT64 type introduced in ramses-logic 0.13.0 is not supported yet.
* The property "timeRange" in Animations introduced in ramses-logic 0.13.0 is not supported yet.
* The new "TimerNode" introduced in ramses-logic 0.13.0 cannot be created in RaCo yet.

## [0.10.0] Animations
* **File version number has changed. Files saved with RaCo 0.10.0 cannot be opened by previous versions.**

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.19)

SET(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo")

project(RaCoOS VERSION 0.10.0)
project(RaCoOS VERSION 0.11.0)

SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)

Expand Down
2 changes: 1 addition & 1 deletion EditorApp/DebugActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void configureDebugActions(Ui::MainWindow* ui, QWidget* widget, raco::core::Comm

auto node = commandInterface->createObject(raco::user_types::Node::typeDescription.typeName, Naming::format("DuckNode"));
auto meshNode = commandInterface->createObject(raco::user_types::MeshNode::typeDescription.typeName, Naming::format("DuckMeshNode"));
commandInterface->moveScenegraphChild(meshNode, node);
commandInterface->moveScenegraphChildren({meshNode}, node);

commandInterface->set(raco::core::ValueHandle{meshNode, &MeshNode::mesh_}, mesh);
commandInterface->set(raco::core::ValueHandle{meshNode, {"materials", "material", "material"}}, material);
Expand Down
12 changes: 5 additions & 7 deletions EditorApp/EditMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ EditMenu::EditMenu(raco::application::RaCoApplication* racoApplication, raco::ob
pasteAction->setEnabled(raco::RaCoClipboard::hasEditorObject());
} else {
auto focusedTreeView = activeObjectTreeDockWithSelection->getCurrentlyActiveTreeView();
auto selectedRows = focusedTreeView->selectionModel()->selectedRows();
auto selectedIndex = focusedTreeView->proxyModel() ? focusedTreeView->proxyModel()->mapToSource(selectedRows.front()) : selectedRows.front();
copyAction->setEnabled(focusedTreeView->canCopy(selectedIndex));
pasteAction->setEnabled(focusedTreeView->canPasteInto(selectedIndex));
auto selectedIndices = focusedTreeView->getSelectedIndices();
auto pasteIndex = focusedTreeView->getSelectedInsertionTargetIndex();
copyAction->setEnabled(focusedTreeView->canCopyAtIndices(selectedIndices));
pasteAction->setEnabled(focusedTreeView->canPasteIntoIndex(pasteIndex, false) || focusedTreeView->canPasteIntoIndex({}, false));
}

QObject::connect(copyAction, &QAction::triggered, [racoApplication, objectTreeDockManager]() {
Expand Down Expand Up @@ -96,10 +96,8 @@ void EditMenu::globalCopyCallback(raco::application::RaCoApplication* racoApplic
void EditMenu::globalPasteCallback(raco::application::RaCoApplication* racoApplication, raco::object_tree::view::ObjectTreeDockManager* objectTreeDockManager) {
if (auto activeObjectTreeDockWithSelection = objectTreeDockManager->getActiveDockWithSelection()) {
auto focusedTreeView = activeObjectTreeDockWithSelection->getCurrentlyActiveTreeView();
auto selectedRows = focusedTreeView->selectionModel()->selectedRows();
auto selectionIndex = selectedRows.empty() ? QModelIndex() : selectedRows.front();

focusedTreeView->globalPasteCallback(selectionIndex);
focusedTreeView->globalPasteCallback(focusedTreeView->getSelectedInsertionTargetIndex());
} else {
auto copiedObjs = raco::RaCoClipboard::get();
racoApplication->activeRaCoProject().commandInterface()->pasteObjects(copiedObjs);
Expand Down
2 changes: 2 additions & 0 deletions EditorApp/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "user_types/AnimationChannel.h"
#include "user_types/CubeMap.h"
#include "user_types/LuaScript.h"
#include "user_types/LuaScriptModule.h"
#include "user_types/MeshNode.h"
#include "user_types/Node.h"
#include "user_types/OrthographicCamera.h"
Expand Down Expand Up @@ -198,6 +199,7 @@ ads::CDockAreaWidget* createAndAddResourceTree(MainWindow* mainWindow, const cha
static const std::vector<std::string> allowedCreateableUserTypes{
AnimationChannel::typeDescription.typeName,
CubeMap::typeDescription.typeName,
LuaScriptModule::typeDescription.typeName,
Material::typeDescription.typeName,
Mesh::typeDescription.typeName,
Texture::typeDescription.typeName,
Expand Down
4 changes: 2 additions & 2 deletions components/libApplication/src/RaCoApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ void RaCoApplication::doOneLoop() {
scenesBackend_->setScene(activeRaCoProject().project(), activeRaCoProject().errors());
}

auto animNodes = engine_->logicEngine().animationNodes();
auto animNodes = engine_->logicEngine().getCollection<rlogic::AnimationNode>();
logicEngineNeedsUpdate_ |= (animNodes.size() > 0);

auto elapsedTime = std::chrono::high_resolution_clock::now() - startTime_;
auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds>(elapsedTime).count();

auto activeProjectRunsTimer = activeRaCoProject().project()->settings()->runTimer_.asBool();
if (activeProjectRunsTimer) {
auto loadedScripts = engine_->logicEngine().scripts();
auto loadedScripts = engine_->logicEngine().getCollection<rlogic::LuaScript>();
for (auto* loadedScript : loadedScripts) {
if (auto* timerInput = loadedScript->getInputs()->getChild("time_ms")) {
timerInput->set(static_cast<int32_t>(elapsedMsec));
Expand Down
2 changes: 1 addition & 1 deletion components/libApplication/src/RaCoProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ std::unique_ptr<RaCoProject> RaCoProject::createNew(RaCoApplication* app) {

result->context_->set({sNode, &user_types::Node::tags_}, std::vector<std::string>({"render_main"}));
result->context_->set({sCamera, &user_types::Node::translation_, &data_storage::Vec3f::z}, 10.0);
result->context_->moveScenegraphChild(sMeshNode, sNode);
result->context_->moveScenegraphChildren({sMeshNode}, sNode);
result->undoStack_.reset();
result->context_->changeMultiplexer().reset();
result->dirty_ = false;
Expand Down
4 changes: 3 additions & 1 deletion components/libApplication/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ raco_package_add_test_resouces(
meshes/negativeScaleQuad.gltf
meshes/ToyCar/ToyCar.gltf
meshes/ToyCar/ToyCar.bin
scripts/compile-error.lua
scripts/moduleDefinition.lua
scripts/moduleDependency.lua
scripts/SimpleScript.lua
scripts/types-scalar.lua
scripts/runtime-error.lua
scripts/compile-error.lua
)
2 changes: 1 addition & 1 deletion components/libApplication/tests/RaCoApplication_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ TEST_F(RaCoApplicationFixture, exportDuckProject) {

auto node = commandInterface->createObject(raco::user_types::Node::typeDescription.typeName, Naming::format("NodeDuck"));
auto meshNode = commandInterface->createObject(raco::user_types::MeshNode::typeDescription.typeName, Naming::format("MeshNodeDuck"));
commandInterface->moveScenegraphChild(meshNode, node);
commandInterface->moveScenegraphChildren({meshNode}, node);

commandInterface->set(raco::core::ValueHandle{meshNode, {"mesh"}}, mesh);
commandInterface->set(raco::core::ValueHandle{meshNode, {"materials", "material", "material"}}, material);
Expand Down
56 changes: 56 additions & 0 deletions components/libApplication/tests/RaCoProject_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "core/PathManager.h"
#include "testing/TestEnvironmentCore.h"
#include "testing/TestUtil.h"
#include "user_types/LuaScript.h"
#include "user_types/LuaScriptModule.h"
#include "user_types/Material.h"
#include "user_types/Mesh.h"
#include "user_types/MeshNode.h"
Expand Down Expand Up @@ -728,4 +730,58 @@ TEST_F(RaCoProjectFixture, copyPasteDeepAnimationReferencingAnimationChannel) {
app.activeRaCoProject().commandInterface()->pasteObjects(clipboard);
ASSERT_NO_FATAL_FAILURE(app.doOneLoop());
}
}

TEST_F(RaCoProjectFixture, copyPasteShallowLuaScriptReferencingLuaScriptModule) {
std::string clipboard;
{
RaCoApplication app{ backend };
app.activeRaCoProject().project()->setCurrentPath((cwd_path() / "project.file").string());
auto module = app.activeRaCoProject().commandInterface()->createObject(raco::user_types::LuaScriptModule::typeDescription.typeName, "m", "m");
auto script = app.activeRaCoProject().commandInterface()->createObject(raco::user_types::LuaScript::typeDescription.typeName, "s", "s");
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ module, &raco::user_types::LuaScriptModule::uri_ }, cwd_path().append("scripts/moduleDefinition.lua").string());
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ script, &raco::user_types::LuaScript::uri_ }, cwd_path().append("scripts/moduleDependency.lua").string());
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ script, {"luaModules", "coalas"} }, module);
app.doOneLoop();

clipboard = app.activeRaCoProject().commandInterface()->copyObjects({ script });
}
{
RaCoApplication app{ backend };
app.activeRaCoProject().commandInterface()->pasteObjects(clipboard);
ASSERT_NO_FATAL_FAILURE(app.doOneLoop());
}
}

TEST_F(RaCoProjectFixture, copyPasteDeepLuaScriptReferencingLuaScriptModule) {
std::string clipboard;
{
RaCoApplication app{ backend };
app.activeRaCoProject().project()->setCurrentPath((cwd_path() / "project.file").string());
auto module = app.activeRaCoProject().commandInterface()->createObject(raco::user_types::LuaScriptModule::typeDescription.typeName, "m", "m");
auto script = app.activeRaCoProject().commandInterface()->createObject(raco::user_types::LuaScript::typeDescription.typeName, "s", "s");
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ module, &raco::user_types::LuaScriptModule::uri_ }, cwd_path().append("scripts/moduleDefinition.lua").string());
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ script, &raco::user_types::LuaScript::uri_ }, cwd_path().append("scripts/moduleDependency.lua").string());
app.doOneLoop();

app.activeRaCoProject().commandInterface()->set({ script, {"luaModules", "coalas"} }, module);
app.doOneLoop();

clipboard = app.activeRaCoProject().commandInterface()->copyObjects({ script }, true);
}
{
RaCoApplication app{ backend };
app.activeRaCoProject().commandInterface()->pasteObjects(clipboard);
ASSERT_NO_FATAL_FAILURE(app.doOneLoop());
}
}
1 change: 1 addition & 0 deletions components/libRamsesBase/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ add_library(libRamsesBase
include/ramses_adaptor/MeshNodeAdaptor.h src/ramses_adaptor/MeshNodeAdaptor.cpp
include/ramses_adaptor/NodeAdaptor.h src/ramses_adaptor/NodeAdaptor.cpp
include/ramses_adaptor/LuaScriptAdaptor.h src/ramses_adaptor/LuaScriptAdaptor.cpp
include/ramses_adaptor/LuaScriptModuleAdaptor.h src/ramses_adaptor/LuaScriptModuleAdaptor.cpp
include/ramses_adaptor/ObjectAdaptor.h src/ramses_adaptor/ObjectAdaptor.cpp
include/ramses_adaptor/BaseCameraAdaptorHelpers.h src/ramses_adaptor/BaseCameraAdaptorHelpers.cpp
include/ramses_adaptor/OrthographicCameraAdaptor.h src/ramses_adaptor/OrthographicCameraAdaptor.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,25 @@ class LuaScriptAdaptor : public ObjectAdaptor, public ILogicPropertyProvider {
bool sync(core::Errors* errors) override;
void readDataFromEngine(core::DataChangeRecorder &recorder);

rlogic::LuaScript* rlogicLuaScript() const {
return luaScript_.get();
}
private:
void setupParentSubscription();
void setupInputValuesSubscription();
std::string generateRamsesObjectName() const;

rlogic::LuaScript* rlogicLuaScript() const {
return luaScript_.get();
}

std::shared_ptr<user_types::LuaScript> editorObject_;
std::unique_ptr<rlogic::LuaScript, std::function<void(rlogic::LuaScript*)>> luaScript_{nullptr, [](auto) {}};
components::Subscription subscription_;
components::Subscription nameSubscription_;
components::Subscription inputSubscription_;
components::Subscription childrenSubscription_;
components::Subscription parentNameSubscription_;
components::Subscription moduleSubscription_;

std::vector<raco::ramses_base::RamsesLuaModule> modules;

// Flag to keep track if a change needs to recreate the lua script in the logicengine
// or if it is sufficient to just update the input properties.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of Ramses Composer
* (see https://github.com/GENIVI/ramses-composer).
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once

#include "core/Handles.h"
#include "ramses_adaptor/ObjectAdaptor.h"
#include "components/DataChangeDispatcher.h"
#include "user_types/LuaScriptModule.h"

#include <ramses-logic/LuaScript.h>

#include <memory>
#include <vector>

namespace raco::ramses_adaptor {

class LuaScriptModuleAdaptor : public ObjectAdaptor {
public:
explicit LuaScriptModuleAdaptor(SceneAdaptor* sceneAdaptor, raco::user_types::SLuaScriptModule editorObject);
SEditorObject baseEditorObject() noexcept override;
const SEditorObject baseEditorObject() const noexcept override;

bool sync(core::Errors* errors) override;

ramses_base::RamsesLuaModule module_;
private:

raco::user_types::SLuaScriptModule editorObject_;
components::Subscription subscription_;
components::Subscription nameSubscription_;
};

}; // namespace raco::ramses_adaptor
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class CoreInterfaceImpl final : public raco::core::EngineInterface {
public:
explicit CoreInterfaceImpl(BaseEngineBackend* backend);
bool parseShader(const std::string& vertexShader, const std::string& geometryShader, const std::string& fragmentShader, const std::string& shaderDefines, raco::core::PropertyInterfaceList& outUniforms, raco::core::PropertyInterfaceList& outAttributes, std::string& error) override;
bool parseLuaScript(const std::string& luaScript, raco::core::PropertyInterfaceList& outInputs, raco::core::PropertyInterfaceList& outOutputs, std::string& error) override;
bool parseLuaScript(const std::string& luaScript, const raco::data_storage::Table& modules, raco::core::PropertyInterfaceList& outInputs, raco::core::PropertyInterfaceList& outOutputs, std::string& error) override;
bool parseLuaScriptModule(const std::string& luaScriptModule, std::string& outError) override;
bool extractLuaDependencies(const std::string& luaScript, std::vector<std::string>& moduleList, std::string& outError) override;
const std::map<int, std::string>& enumerationDescription(raco::core::EngineEnumeration type) const override;

private:
Expand Down
14 changes: 14 additions & 0 deletions components/libRamsesBase/include/ramses_base/RamsesHandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#pragma once

#include "log_system/log.h"
#include "ramses_base/Utils.h"
#include <ramses-utils.h>

#include <memory>
Expand Down Expand Up @@ -40,6 +41,7 @@
#include <ramses-logic/AnimationNode.h>
#include <ramses-logic/DataArray.h>
#include <ramses-logic/LogicEngine.h>
#include <ramses-logic/LuaModule.h>
#include <ramses-logic/RamsesAppearanceBinding.h>
#include <ramses-logic/RamsesCameraBinding.h>
#include <ramses-logic/RamsesNodeBinding.h>
Expand Down Expand Up @@ -543,6 +545,7 @@ using UniqueRamsesAppearanceBinding = std::unique_ptr<rlogic::RamsesAppearanceBi
using UniqueRamsesDataArray = std::unique_ptr<rlogic::DataArray, std::function<void(rlogic::DataArray*)>>;
using UniqueRamsesNodeBinding = std::unique_ptr<rlogic::RamsesNodeBinding, std::function<void(rlogic::RamsesNodeBinding*)>>;
using UniqueRamsesCameraBinding = std::unique_ptr<rlogic::RamsesCameraBinding, std::function<void(rlogic::RamsesCameraBinding*)>>;
using RamsesLuaModule = RamsesHandle<rlogic::LuaModule>;

using RamsesAnimationNode = RamsesHandle<rlogic::AnimationNode>;

Expand Down Expand Up @@ -579,6 +582,17 @@ inline UniqueRamsesCameraBinding ramsesCameraBinding(ramses::Camera& camera, rlo
}};
}

inline RamsesLuaModule ramsesLuaModule(const std::string& luaContent, rlogic::LogicEngine* logicEngine, const std::string& name) {
auto moduleConfig = defaultLuaConfig();
return {
logicEngine->createLuaModule(luaContent, moduleConfig, name), [logicEngine](rlogic::LuaModule* module) {
if (module) {
logicEngine->destroy(*module);
}
}};

}

struct RamsesAnimationChannelData {
std::string name;
rlogic::EInterpolationType interpolationType;
Expand Down
9 changes: 8 additions & 1 deletion components/libRamsesBase/include/ramses_base/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <ramses-client-api/EffectInputDataType.h>
#include <ramses-client.h>
#include <ramses-framework-api/RamsesVersion.h>
#include <ramses-logic/LuaConfig.h>
#include <ramses-logic/RamsesLogicVersion.h>
#include <string>

Expand All @@ -31,7 +32,13 @@ bool parseShaderText(ramses::Scene& scene, const std::string& vertexShader, cons

// Parse luascripts using ramses logic and return set of in and out parameters with name and type.
// Returns true if script can be successfully parsed.
bool parseLuaScript(LogicEngine& engine, const std::string& luaScript, PropertyInterfaceList& outInputs, PropertyInterfaceList& outOutputs, std::string& outError);
bool parseLuaScript(LogicEngine& engine, const std::string& luaScript, const raco::data_storage::Table& modules, PropertyInterfaceList& outInputs, PropertyInterfaceList& outOutputs, std::string& outError);

// Parse luascript module using ramses logic.
// Returns true if module can be successfully parsed.
bool parseLuaScriptModule(LogicEngine& engine, const std::string& luaScriptModule, std::string& outError);

rlogic::LuaConfig defaultLuaConfig();

ramses::RamsesVersion getRamsesVersion();
rlogic::RamsesLogicVersion getLogicEngineVersion();
Expand Down
Loading

0 comments on commit 1a1f2dc

Please sign in to comment.