Skip to content

Commit

Permalink
Release v0.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
AchimStremplat committed Jul 23, 2021
1 parent b50201c commit 1497931
Show file tree
Hide file tree
Showing 64 changed files with 3,539 additions and 718 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
### Known Bugs
-->

## [0.8.3]

### Changes
* Update from ramses-logic 0.6.2 to ramses-logic 0.7.0
* Locked Property Browsers whose item has been deleted, will become automatically unlocked.
* Dynamic LuaScript properties now follow the same alphabetical order as propagated by ramses-logic.
* Material uniforms are now sorted according to their chronological declaration appearance in the shader files.
* Added support for struct properties in the data model. Converted Camera viewport and frustum properties to structs. Allow the camera viewport and frustum structs to be linked as a whole.

### Fixes
* Deleting a Node will not affect locked Property Browsers anymore, except when the Property Browser was locked onto the now deleted Node.
* Closed docks do not get cached/saved anymore.
* The Property Browser does not get reset anymore when pressing the Delete key while a read-only object is selected.

## [0.8.2]

### Added
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.8.2)
project(RaCoOS VERSION 0.8.3)

SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)

Expand Down
8 changes: 6 additions & 2 deletions EditorApp/RaCoDockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ void RaCoDockManager::saveCustomLayouts(QSettings& settings) {
void RaCoDockManager::saveCurrentLayoutInCache(QSettings& settings) {
cachedLayoutInfo_.clear();
for (auto dockWidget : dockWidgetsMap()) {
cachedLayoutInfo_.append({dockWidget->windowTitle(), dockWidget->objectName()});
if (!dockWidget->isClosed()) {
cachedLayoutInfo_.append({dockWidget->windowTitle(), dockWidget->objectName()});
}
}

cachedLayoutState_ = ads::CDockManager::saveState();
Expand All @@ -99,7 +101,9 @@ void RaCoDockManager::addCustomLayout(const QString& layoutName) {
}

for (auto dockWidget : dockWidgetsMap()) {
customLayoutInfos_[layoutName].append({dockWidget->windowTitle(), dockWidget->objectName()});
if (!dockWidget->isClosed()) {
customLayoutInfos_[layoutName].append({dockWidget->windowTitle(), dockWidget->objectName()});
}
}

ads::CDockManager::addPerspective(layoutName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ namespace raco::components {
* 12: Added 'private' property in meshnode material container.
* Renamed 'depthfunction' -> 'depthFunction' in options container of meshnode material slot.
* Added LinkEndAnnotation to material uniform properties
* 13: Introduced Struct properties and converted
* - material and meshnode blend options
* - camera viewport and frustum
*/
constexpr int RAMSES_PROJECT_FILE_VERSION = 12;
constexpr int RAMSES_PROJECT_FILE_VERSION = 13;
QJsonDocument migrateProject(const QJsonDocument& doc);
} // namespace raco::components
363 changes: 340 additions & 23 deletions components/libComponents/src/RamsesProjectMigration.cpp

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class ObjectAdaptor;

class BaseCameraAdaptorHelpers {
public:
static std::array<components::Subscription, 4> viewportSubscriptions(SceneAdaptor* sceneAdaptor, ObjectAdaptor* cameraAdaptor);
static void sync(std::shared_ptr<user_types::BaseCamera> editorObject, ramses::Camera* ramsesCamera, rlogic::RamsesCameraBinding* cameraBinding);
static const rlogic::Property* getProperty(rlogic::RamsesCameraBinding* cameraBinding, const std::vector<std::string>& propertyNamesVector);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MaterialAdaptor final : public TypedObjectAdaptor<user_types::Material, ra
raco::ramses_base::UniqueRamsesAppearanceBinding appearanceBinding_;

components::Subscription subscription_;
std::array<components::Subscription, 10> optionsSubscriptions_;
components::Subscription optionsSubscription_;
components::Subscription uniformSubscription_;
};

Expand Down
7 changes: 3 additions & 4 deletions components/libRamsesBase/include/ramses_adaptor/NodeAdaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ class SpatialAdaptor : public TypedObjectAdaptor<EditorType, RamsesType>, public
public:
explicit SpatialAdaptor(SceneAdaptor* sceneAdaptor, std::shared_ptr<EditorType> editorObject, RamsesHandle<RamsesType>&& ramsesObject, NodeAdaptor* parent = nullptr)
: TypedObjectAdaptor<EditorType, RamsesType>{sceneAdaptor, editorObject, std::move(ramsesObject)},
nodeBinding_{raco::ramses_base::ramsesNodeBinding(&sceneAdaptor->logicEngine())},
nodeBinding_{raco::ramses_base::ramsesNodeBinding(this->ramsesObject(), &sceneAdaptor->logicEngine())},
subscriptions_{
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{editorObject}.get("visible"), [this]() { this->tagDirty(); }),
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{editorObject}.get("children"), [this]() { this->tagDirty(); }),
sceneAdaptor->dispatcher()->registerOnChildren(core::ValueHandle{editorObject}.get("translation"), [this](auto) { this->tagDirty(); }),
sceneAdaptor->dispatcher()->registerOnChildren(core::ValueHandle{editorObject}.get("scale"), [this](auto) { this->tagDirty(); }),
sceneAdaptor->dispatcher()->registerOnChildren(core::ValueHandle{editorObject}.get("rotation"), [this](auto) { this->tagDirty(); })} {

nodeBinding_->setRamsesNode(&this->ramsesObject());
sceneAdaptor->dispatcher()->registerOnChildren(core::ValueHandle{editorObject}.get("rotation"), [this](auto) { this->tagDirty(); })} {

}

void getLogicNodes(std::vector<rlogic::LogicNode*>& logicNodes) const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class OrthographicCameraAdaptor : public SpatialAdaptor<user_types::Orthographic
const rlogic::Property* getProperty(const std::vector<std::string>& propertyNamesVector) override;

private:
std::array<components::Subscription, 4> viewportSubscriptions_;
std::array<components::Subscription, 6> frustrumSubscriptions_;
components::Subscription viewportSubscription_;
components::Subscription frustrumSubscription_;
raco::ramses_base::UniqueRamsesCameraBinding cameraBinding_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class PerspectiveCameraAdaptor : public SpatialAdaptor<user_types::PerspectiveCa
const rlogic::Property* getProperty(const std::vector<std::string>& propertyNamesVector) override;

private:
std::array<components::Subscription, 4> viewportSubscriptions_;
std::array<components::Subscription, 4> frustrumSubscriptions_;
components::Subscription viewportSubscription_;
components::Subscription frustrumSubscription_;
raco::ramses_base::UniqueRamsesCameraBinding cameraBinding_;
};

Expand Down
3 changes: 2 additions & 1 deletion components/libRamsesBase/include/ramses_adaptor/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ inline void getLuaOutputFromEngine(const rlogic::Property& property, const core:
ReadFromEngineManager::setValueFromEngineValue(valueHandle, property.get<std::string>().value(), recorder);
break;
}
case PrimitiveType::Table: {
case PrimitiveType::Table:
case PrimitiveType::Struct: {
for (size_t i{0}; i < valueHandle.size(); i++) {
if (property.getType() == rlogic::EPropertyType::Array) {
getLuaOutputFromEngine(*property.getChild(i), valueHandle[i], recorder);
Expand Down
16 changes: 8 additions & 8 deletions components/libRamsesBase/include/ramses_base/RamsesHandles.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,20 @@ using UniqueRamsesAppearanceBinding = std::unique_ptr<rlogic::RamsesAppearanceBi
using UniqueRamsesNodeBinding = std::unique_ptr<rlogic::RamsesNodeBinding, std::function<void(rlogic::RamsesNodeBinding*)>>;
using UniqueRamsesCameraBinding = std::unique_ptr<rlogic::RamsesCameraBinding, std::function<void(rlogic::RamsesCameraBinding*)>>;

inline UniqueRamsesAppearanceBinding ramsesAppearanceBinding(rlogic::LogicEngine* logicEngine, const std::string& name) {
return {logicEngine->createRamsesAppearanceBinding(name), [logicEngine](rlogic::RamsesAppearanceBinding* ptr) {
inline UniqueRamsesAppearanceBinding ramsesAppearanceBinding(ramses::Appearance& appearance, rlogic::LogicEngine* logicEngine, const std::string& name) {
return {logicEngine->createRamsesAppearanceBinding(appearance, name), [logicEngine](rlogic::RamsesAppearanceBinding* ptr) {
logicEngine->destroy(*ptr);
}};
}

inline UniqueRamsesNodeBinding ramsesNodeBinding(rlogic::LogicEngine* logicEngine) {
return {logicEngine->createRamsesNodeBinding(), [logicEngine](rlogic::RamsesNodeBinding* binding) {
logicEngine->destroy(*binding);
}};
inline UniqueRamsesNodeBinding ramsesNodeBinding(ramses::Node& node, rlogic::LogicEngine* logicEngine) {
return {logicEngine->createRamsesNodeBinding(node), [logicEngine](rlogic::RamsesNodeBinding* binding) {
logicEngine->destroy(*binding);
}};
}

inline UniqueRamsesCameraBinding ramsesCameraBinding(rlogic::LogicEngine* logicEngine) {
return {logicEngine->createRamsesCameraBinding(), [logicEngine](rlogic::RamsesCameraBinding* binding) {
inline UniqueRamsesCameraBinding ramsesCameraBinding(ramses::Camera& camera, rlogic::LogicEngine* logicEngine) {
return {logicEngine->createRamsesCameraBinding(camera), [logicEngine](rlogic::RamsesCameraBinding* binding) {
logicEngine->destroy(*binding);
}};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,48 +20,35 @@

namespace raco::ramses_adaptor {

std::array<components::Subscription, 4> BaseCameraAdaptorHelpers::viewportSubscriptions(SceneAdaptor* sceneAdaptor, ObjectAdaptor* cameraAdaptor) {
return std::array<components::Subscription, 4> {
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{ cameraAdaptor->baseEditorObject() }.get("viewPortOffsetX"), [cameraAdaptor]() {
cameraAdaptor->tagDirty();
}),
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{ cameraAdaptor->baseEditorObject() }.get("viewPortOffsetY"), [cameraAdaptor]() {
cameraAdaptor->tagDirty();
}),
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{ cameraAdaptor->baseEditorObject() }.get("viewPortWidth"), [cameraAdaptor]() {
cameraAdaptor->tagDirty();
}),
sceneAdaptor->dispatcher()->registerOn(core::ValueHandle{ cameraAdaptor->baseEditorObject() }.get("viewPortHeight"), [cameraAdaptor]() {
cameraAdaptor->tagDirty();
})
};
}

void BaseCameraAdaptorHelpers::sync(std::shared_ptr<user_types::BaseCamera> editorObject, ramses::Camera* ramsesCamera, rlogic::RamsesCameraBinding* cameraBinding) {
ramsesCamera->setViewport(*editorObject->viewportOffsetX_, *editorObject->viewportOffsetY_, *editorObject->viewportWidth_, *editorObject->viewportHeight_);
ramsesCamera->setViewport(*editorObject->viewport_->offsetX_, *editorObject->viewport_->offsetY_, *editorObject->viewport_->width_, *editorObject->viewport_->height_);
cameraBinding->setName(std::string(editorObject->objectName() + "_CameraBinding").c_str());
cameraBinding->getInputs()->getChild("viewPortProperties")->getChild("viewPortOffsetX")->set(static_cast<int>(*editorObject->viewportOffsetX_));
cameraBinding->getInputs()->getChild("viewPortProperties")->getChild("viewPortOffsetY")->set(static_cast<int>(*editorObject->viewportOffsetY_));
cameraBinding->getInputs()->getChild("viewport")->getChild("offsetX")->set(static_cast<int>(*editorObject->viewport_->offsetX_));
cameraBinding->getInputs()->getChild("viewport")->getChild("offsetY")->set(static_cast<int>(*editorObject->viewport_->offsetY_));
// Ramses asserts if the viewport width/height <=0. Unfortunately we cannot prevent a link from setting the value to <=0?
cameraBinding->getInputs()->getChild("viewPortProperties")->getChild("viewPortWidth")->set(std::max(1, static_cast<int>(*editorObject->viewportWidth_)));
cameraBinding->getInputs()->getChild("viewPortProperties")->getChild("viewPortHeight")->set(std::max(1, static_cast<int>(*editorObject->viewportHeight_)));
cameraBinding->getInputs()->getChild("viewport")->getChild("width")->set(std::max(1, static_cast<int>(*editorObject->viewport_->width_)));
cameraBinding->getInputs()->getChild("viewport")->getChild("height")->set(std::max(1, static_cast<int>(*editorObject->viewport_->height_)));
}

const rlogic::Property* BaseCameraAdaptorHelpers::getProperty(rlogic::RamsesCameraBinding* cameraBinding, const std::vector<std::string>& propertyNamesVector) {
static std::map<std::string_view, std::string_view> propertyNameToViewportPropertyName{
{ "viewPortOffsetX", "viewPortOffsetX" },
{ "viewPortOffsetY", "viewPortOffsetY" },
{ "viewPortWidth", "viewPortWidth" },
{ "viewPortHeight", "viewPortHeight" }
{ "offsetX", "offsetX" },
{ "offsetY", "offsetY" },
{ "width", "width" },
{ "height", "height" }
};
std::string const propName = propertyNamesVector[0];
assert(propertyNamesVector.size() == 1);
if (propertyNameToViewportPropertyName.find(propName) != propertyNameToViewportPropertyName.end()) {
auto ramsesViewportProperties = cameraBinding->getInputs()->getChild("viewPortProperties");
assert(ramsesViewportProperties != nullptr);
auto ramsesViewportProperty = ramsesViewportProperties->getChild(propertyNameToViewportPropertyName.at(propName));
assert(ramsesViewportProperty != nullptr);
return ramsesViewportProperty;
if (propertyNamesVector.size() == 1 && propertyNamesVector[0] == "viewport") {
return cameraBinding->getInputs()->getChild("viewport");
}
if (propertyNamesVector.size() == 2 && propertyNamesVector[0] == "viewport") {
std::string const propName = propertyNamesVector[1];
if (propertyNameToViewportPropertyName.find(propName) != propertyNameToViewportPropertyName.end()) {
auto ramsesViewportProperties = cameraBinding->getInputs()->getChild("viewport");
assert(ramsesViewportProperties != nullptr);
auto ramsesViewportProperty = ramsesViewportProperties->getChild(propertyNameToViewportPropertyName.at(propName));
assert(ramsesViewportProperty != nullptr);
return ramsesViewportProperty;
}
}
return nullptr;
}
Expand Down
40 changes: 5 additions & 35 deletions components/libRamsesBase/src/ramses_adaptor/MaterialAdaptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,38 +43,9 @@ MaterialAdaptor::MaterialAdaptor(SceneAdaptor* sceneAdaptor, user_types::SMateri
subscription_{sceneAdaptor_->dispatcher()->registerOnPreviewDirty(editorObject(), [this]() {
tagDirty();
})},
optionsSubscriptions_{
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendOperationColor"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendOperationAlpha"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendFactorSrcColor"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendFactorDestColor"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendFactorSrcAlpha"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendFactorDestAlpha"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"blendColor"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"depthwrite"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"depthFunction"}}, [this](auto) {
tagDirty();
}),
sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"cullmode"}}, [this](auto) {
tagDirty();
})
},
optionsSubscription_{sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"options"}}, [this](auto) {
tagDirty();
})},
uniformSubscription_{sceneAdaptor_->dispatcher()->registerOnChildren({editorObject(), {"uniforms"}}, [this](auto) {
tagDirty();
})} {
Expand Down Expand Up @@ -108,12 +79,11 @@ bool MaterialAdaptor::sync(core::Errors* errors) {
// Only create appearance binding and set uniforms & blend options if we are using a valid shader but not if
// we are using the empty default shaders.
if (editorObject()->isShaderValid()) {
core::ValueHandle optionsHandle = {editorObject()};
core::ValueHandle optionsHandle = {editorObject(), {"options"}};
core::ValueHandle uniformsHandle = {editorObject(), {"uniforms"}};
updateAppearance(sceneAdaptor_, appearance_, optionsHandle, uniformsHandle);

appearanceBinding_ = raco::ramses_base::ramsesAppearanceBinding(&sceneAdaptor_->logicEngine(), editorObject()->objectName() + "_AppearanceBinding");
appearanceBinding_->setRamsesAppearance(appearance_->get());
appearanceBinding_ = raco::ramses_base::ramsesAppearanceBinding(*appearance_->get(), & sceneAdaptor_->logicEngine(), editorObject()->objectName() + "_AppearanceBinding");
}

tagDirty(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ void MeshNodeAdaptor::syncMaterial(size_t index) {

(*privateAppearance_)->setName(std::string(this->editorObject()->objectName() + "_Appearance").c_str());

appearanceBinding_ = raco::ramses_base::ramsesAppearanceBinding(&sceneAdaptor_->logicEngine(), editorObject()->objectName() + "_AppearanceBinding");
appearanceBinding_->setRamsesAppearance(privateAppearance_->get());
appearanceBinding_ = raco::ramses_base::ramsesAppearanceBinding(*privateAppearance_->get(), &sceneAdaptor_->logicEngine(), editorObject()->objectName() + "_AppearanceBinding");

} else {
currentAppearance_ = materialAdapt->appearance();
Expand Down
Loading

0 comments on commit 1497931

Please sign in to comment.