Skip to content

Commit 3b7e693

Browse files
committed
Release v1.9.1
1 parent 68c4abe commit 3b7e693

File tree

6 files changed

+83
-3
lines changed

6 files changed

+83
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
2424
2525
-->
2626

27+
## [1.9.1] Bugfix Release
28+
29+
### Fixes
30+
* Prevent stencil and scissor options in materials and meshnodes from being reset to their defaults by undo/redo operations.
31+
32+
2733
## [1.9.0] Stencil & Scissor support, Linkable instance count, Texture optimization, Misc Bugfixes
2834
* **File version number has changed. Files saved with RaCo 1.9.0 cannot be opened by previous versions.**
2935

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.19)
1111

1212
SET(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo")
1313

14-
project(RaCoOS VERSION 1.9.0)
14+
project(RaCoOS VERSION 1.9.1)
1515

1616
SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)
1717

datamodel/libCore/tests/ProjectMigration_test.cpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,3 +1073,60 @@ TEST_F(MigrationTest, check_user_factory_can_create_all_static_properties) {
10731073
}
10741074
}
10751075
}
1076+
1077+
void change_property(ValueBase* value) {
1078+
switch (value->type()) {
1079+
case PrimitiveType::Bool:
1080+
*value = !value->asBool();
1081+
break;
1082+
case PrimitiveType::Int:
1083+
*value = value->asInt() + 1;
1084+
break;
1085+
case PrimitiveType::Int64:
1086+
*value = value->asInt64() + 1;
1087+
break;
1088+
case PrimitiveType::Double:
1089+
*value = value->asDouble() + 1;
1090+
break;
1091+
case PrimitiveType::String:
1092+
*value = value->asString() + "postfix";
1093+
break;
1094+
case PrimitiveType::Ref:
1095+
// We can't just change the pointer here but would need to create another valid object as pointer target.
1096+
// Ignore for now since we don't have Ref properties inside structs yet.
1097+
break;
1098+
case PrimitiveType::Table:
1099+
case PrimitiveType::Struct: {
1100+
auto& container = value->getSubstructure();
1101+
for (size_t index = 0; index < container.size(); index++) {
1102+
change_property(container.get(index));
1103+
}
1104+
} break;
1105+
}
1106+
}
1107+
1108+
TEST_F(MigrationTest, check_struct_copy_operators) {
1109+
// Check that the copy constructor and operator= work for all struct types.
1110+
// If this fails fix the implementation of the failing struct member function.
1111+
1112+
auto& userFactory{UserObjectFactory::getInstance()};
1113+
1114+
for (auto& item : userFactory.getStructTypes()) {
1115+
auto name = item.first;
1116+
auto property = userFactory.createValue(name);
1117+
ASSERT_TRUE(property->type() != PrimitiveType::Ref) << fmt::format("Struct name {}", name);
1118+
1119+
change_property(property);
1120+
1121+
// clone uses the copy constructor
1122+
auto prop_clone = property->clone(nullptr);
1123+
ASSERT_TRUE(*property == *prop_clone) << fmt::format("Struct name {}", name);
1124+
1125+
// check operator=
1126+
auto property_2 = userFactory.createValue(name);
1127+
ASSERT_FALSE(*property_2 == *property);
1128+
1129+
*property_2 = *property;
1130+
ASSERT_TRUE(*property_2 == *property) << fmt::format("Struct name {}", name);
1131+
}
1132+
}

datamodel/libUserTypes/include/user_types/Material.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ class BlendOptions : public StructBase {
192192
depthwrite_(other.depthwrite_),
193193
depthFunction_(other.depthFunction_),
194194
cullmode_(other.cullmode_),
195-
colorWriteMask_(other.colorWriteMask_) {
195+
colorWriteMask_(other.colorWriteMask_),
196+
scissorOptions_(other.scissorOptions_),
197+
stencilOptions_(other.stencilOptions_) {
196198
}
197199

198200
BlendOptions& operator=(const BlendOptions& other) {
@@ -207,6 +209,8 @@ class BlendOptions : public StructBase {
207209
depthFunction_ = other.depthFunction_;
208210
cullmode_ = other.cullmode_;
209211
colorWriteMask_ = other.colorWriteMask_;
212+
scissorOptions_ = other.scissorOptions_;
213+
stencilOptions_ = other.stencilOptions_;
210214
return *this;
211215
}
212216

@@ -222,6 +226,8 @@ class BlendOptions : public StructBase {
222226
depthFunction_.copyAnnotationData(other.depthFunction_);
223227
cullmode_.copyAnnotationData(other.cullmode_);
224228
colorWriteMask_.copyAnnotationData(other.colorWriteMask_);
229+
scissorOptions_.copyAnnotationData(other.scissorOptions_);
230+
stencilOptions_.copyAnnotationData(other.stencilOptions_);
225231
}
226232

227233
std::vector<std::pair<std::string, ValueBase*>> getProperties() {

datamodel/libUserTypes/include/user_types/UserObjectFactory.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ class UserObjectFactory : public raco::core::UserObjectFactoryInterface {
290290
struct StructDescriptor {
291291
ReflectionInterface::TypeDescriptor description;
292292
StructCreationFunction createFunc;
293+
ValueCreationFunction createValueFunc;
293294
};
294295

295296

@@ -342,6 +343,8 @@ class UserObjectFactory : public raco::core::UserObjectFactoryInterface {
342343
template <class T>
343344
static std::shared_ptr<ClassWithReflectedMembers> createStructInternal();
344345
template <class T>
346+
static data_storage::ValueBase* createStructValueInternal();
347+
template <class T>
345348
static data_storage::ValueBase* createValueInternal() {
346349
return new Value<std::shared_ptr<T>>();
347350
}

datamodel/libUserTypes/src/UserObjectFactory.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ std::shared_ptr<ClassWithReflectedMembers> UserObjectFactory::createStructIntern
5353
return std::make_shared<T>();
5454
}
5555

56+
template <class T>
57+
data_storage::ValueBase* UserObjectFactory::createStructValueInternal() {
58+
return new Value<T>();
59+
}
5660

5761
template <class... Args>
5862
std::map<std::string, UserObjectFactory::TypeDescriptor> UserObjectFactory::makeTypeMap() {
@@ -79,7 +83,7 @@ std::map<std::string, UserObjectFactory::AnnotationDescriptor> UserObjectFactory
7983
template <class... Args>
8084
std::map<std::string, UserObjectFactory::StructDescriptor> UserObjectFactory::makeStructTypeMap() {
8185
return std::map<std::string, UserObjectFactory::StructDescriptor>{
82-
{Args::typeDescription.typeName, {Args::typeDescription, createStructInternal<Args>}}...};
86+
{Args::typeDescription.typeName, {Args::typeDescription, createStructInternal<Args>, createStructValueInternal<Args>}}...};
8387
}
8488

8589
UserObjectFactory::UserObjectFactory() {
@@ -184,6 +188,10 @@ data_storage::ValueBase* UserObjectFactory::createValue(const std::string& type)
184188
return it->second();
185189
}
186190
}
191+
if (auto it = structTypes_.find(type); it != structTypes_.end()) {
192+
return it->second.createValueFunc();
193+
}
194+
187195
return new Value<SEditorObject>();
188196
}
189197

0 commit comments

Comments
 (0)