Skip to content

Commit

Permalink
Release v1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
webermm committed Jun 20, 2023
1 parent 68c4abe commit 3b7e693
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
-->

## [1.9.1] Bugfix Release

### Fixes
* Prevent stencil and scissor options in materials and meshnodes from being reset to their defaults by undo/redo operations.


## [1.9.0] Stencil & Scissor support, Linkable instance count, Texture optimization, Misc Bugfixes
* **File version number has changed. Files saved with RaCo 1.9.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 1.9.0)
project(RaCoOS VERSION 1.9.1)

SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)

Expand Down
57 changes: 57 additions & 0 deletions datamodel/libCore/tests/ProjectMigration_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,3 +1073,60 @@ TEST_F(MigrationTest, check_user_factory_can_create_all_static_properties) {
}
}
}

void change_property(ValueBase* value) {
switch (value->type()) {
case PrimitiveType::Bool:
*value = !value->asBool();
break;
case PrimitiveType::Int:
*value = value->asInt() + 1;
break;
case PrimitiveType::Int64:
*value = value->asInt64() + 1;
break;
case PrimitiveType::Double:
*value = value->asDouble() + 1;
break;
case PrimitiveType::String:
*value = value->asString() + "postfix";
break;
case PrimitiveType::Ref:
// We can't just change the pointer here but would need to create another valid object as pointer target.
// Ignore for now since we don't have Ref properties inside structs yet.
break;
case PrimitiveType::Table:
case PrimitiveType::Struct: {
auto& container = value->getSubstructure();
for (size_t index = 0; index < container.size(); index++) {
change_property(container.get(index));
}
} break;
}
}

TEST_F(MigrationTest, check_struct_copy_operators) {
// Check that the copy constructor and operator= work for all struct types.
// If this fails fix the implementation of the failing struct member function.

auto& userFactory{UserObjectFactory::getInstance()};

for (auto& item : userFactory.getStructTypes()) {
auto name = item.first;
auto property = userFactory.createValue(name);
ASSERT_TRUE(property->type() != PrimitiveType::Ref) << fmt::format("Struct name {}", name);

change_property(property);

// clone uses the copy constructor
auto prop_clone = property->clone(nullptr);
ASSERT_TRUE(*property == *prop_clone) << fmt::format("Struct name {}", name);

// check operator=
auto property_2 = userFactory.createValue(name);
ASSERT_FALSE(*property_2 == *property);

*property_2 = *property;
ASSERT_TRUE(*property_2 == *property) << fmt::format("Struct name {}", name);
}
}
8 changes: 7 additions & 1 deletion datamodel/libUserTypes/include/user_types/Material.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ class BlendOptions : public StructBase {
depthwrite_(other.depthwrite_),
depthFunction_(other.depthFunction_),
cullmode_(other.cullmode_),
colorWriteMask_(other.colorWriteMask_) {
colorWriteMask_(other.colorWriteMask_),
scissorOptions_(other.scissorOptions_),
stencilOptions_(other.stencilOptions_) {
}

BlendOptions& operator=(const BlendOptions& other) {
Expand All @@ -207,6 +209,8 @@ class BlendOptions : public StructBase {
depthFunction_ = other.depthFunction_;
cullmode_ = other.cullmode_;
colorWriteMask_ = other.colorWriteMask_;
scissorOptions_ = other.scissorOptions_;
stencilOptions_ = other.stencilOptions_;
return *this;
}

Expand All @@ -222,6 +226,8 @@ class BlendOptions : public StructBase {
depthFunction_.copyAnnotationData(other.depthFunction_);
cullmode_.copyAnnotationData(other.cullmode_);
colorWriteMask_.copyAnnotationData(other.colorWriteMask_);
scissorOptions_.copyAnnotationData(other.scissorOptions_);
stencilOptions_.copyAnnotationData(other.stencilOptions_);
}

std::vector<std::pair<std::string, ValueBase*>> getProperties() {
Expand Down
3 changes: 3 additions & 0 deletions datamodel/libUserTypes/include/user_types/UserObjectFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ class UserObjectFactory : public raco::core::UserObjectFactoryInterface {
struct StructDescriptor {
ReflectionInterface::TypeDescriptor description;
StructCreationFunction createFunc;
ValueCreationFunction createValueFunc;
};


Expand Down Expand Up @@ -342,6 +343,8 @@ class UserObjectFactory : public raco::core::UserObjectFactoryInterface {
template <class T>
static std::shared_ptr<ClassWithReflectedMembers> createStructInternal();
template <class T>
static data_storage::ValueBase* createStructValueInternal();
template <class T>
static data_storage::ValueBase* createValueInternal() {
return new Value<std::shared_ptr<T>>();
}
Expand Down
10 changes: 9 additions & 1 deletion datamodel/libUserTypes/src/UserObjectFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ std::shared_ptr<ClassWithReflectedMembers> UserObjectFactory::createStructIntern
return std::make_shared<T>();
}

template <class T>
data_storage::ValueBase* UserObjectFactory::createStructValueInternal() {
return new Value<T>();
}

template <class... Args>
std::map<std::string, UserObjectFactory::TypeDescriptor> UserObjectFactory::makeTypeMap() {
Expand All @@ -79,7 +83,7 @@ std::map<std::string, UserObjectFactory::AnnotationDescriptor> UserObjectFactory
template <class... Args>
std::map<std::string, UserObjectFactory::StructDescriptor> UserObjectFactory::makeStructTypeMap() {
return std::map<std::string, UserObjectFactory::StructDescriptor>{
{Args::typeDescription.typeName, {Args::typeDescription, createStructInternal<Args>}}...};
{Args::typeDescription.typeName, {Args::typeDescription, createStructInternal<Args>, createStructValueInternal<Args>}}...};
}

UserObjectFactory::UserObjectFactory() {
Expand Down Expand Up @@ -184,6 +188,10 @@ data_storage::ValueBase* UserObjectFactory::createValue(const std::string& type)
return it->second();
}
}
if (auto it = structTypes_.find(type); it != structTypes_.end()) {
return it->second.createValueFunc();
}

return new Value<SEditorObject>();
}

Expand Down

0 comments on commit 3b7e693

Please sign in to comment.