Skip to content

Commit

Permalink
2024.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
maxon-madam committed Dec 11, 2023
1 parent 6525969 commit 55bd2ff
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ MAXON_METHOD maxon::Bool DotsPresetAssetTypeImpl::LoadPreset(
return true;

// Attempt to instantiate the specific preset type and retrieve the custom data attached to it.
const DotsPresetAssetImpl* impl = DotsPresetAssetImpl::GetOrDefault(preset);
const DotsPresetAssetImpl* impl = DotsPresetAssetImpl::GetOrNull(preset);
if (!impl)
return false;

Expand Down
6 changes: 3 additions & 3 deletions plugins/example.image/source/examples_color_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ maxon::Result<void> GetColorProfilesFromFile(
// To run this example, you must download these files and put them next to this cpp file.

// Construct the URLs for the two ICC profiles next to this cpp file.
const maxon::Url directory = maxon::Url(maxon::String(__FILE__)).GetDirectory();
const maxon::Url directory = maxon::Url(maxon::String(MAXON_FILE)).GetDirectory();
const maxon::Url srgbIccFile = (directory + "sRGB2014.icc"_s) iferr_return;
const maxon::Url xyzIccFile = (directory + "D65_XYZ.icc"_s) iferr_return;

Expand Down Expand Up @@ -149,7 +149,7 @@ maxon::Result<void> WriteColorProfileToFile()

// Construct a URL for an ICC file next to this cpp file and write it to disk, written is
// here effectively an sRGB-2.2 ICC profile from the builtin color RGB color space.
const maxon::Url directory = maxon::Url(maxon::String(__FILE__)).GetDirectory();
const maxon::Url directory = maxon::Url(maxon::String(MAXON_FILE)).GetDirectory();
const maxon::Url url = (directory + "myProfile.icc"_s) iferr_return;
profile.WriteProfileToFile(url) iferr_return;

Expand Down Expand Up @@ -450,7 +450,7 @@ maxon::Result<void> ConvertTextureWithColorProfile(
// Instantiate a PSD file format output handler and define a storage URL next to this cpp file
// with the file name "texture.psd",
const maxon::MediaOutputUrlRef psdFormat = maxon::ImageSaverClasses::Psd().Create() iferr_return;
const maxon::Url url = (maxon::Url(maxon::String(__FILE__)).GetDirectory() + "texture.psd"_s) iferr_return;
const maxon::Url url = (maxon::Url(maxon::String(MAXON_FILE)).GetDirectory() + "texture.psd"_s) iferr_return;

// To store the ImageRef #image, it must be inserted below a type instance in the ImageInterface
// hierarchy that supports serialization, e.g., ImageTextureInterface.
Expand Down
2 changes: 1 addition & 1 deletion plugins/example.image/source/examples_ocio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ maxon::Result<void> ConvertOcioColorsArbitrarily(BaseDocument* doc)
}

// Load the "sRGB2014" ICC profile located next to this file.
const maxon::Url directory = maxon::Url(maxon::String(__FILE__)).GetDirectory();
const maxon::Url directory = maxon::Url(maxon::String(MAXON_FILE)).GetDirectory();
const maxon::Url sRgb2014File = (directory + "sRGB2014.icc"_s) iferr_return;
if (sRgb2014File.IoDetect() == maxon::IODETECT::NONEXISTENT)
return maxon::IoError(
Expand Down
14 changes: 11 additions & 3 deletions plugins/example.migration_2024/source/oboundingbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,16 @@ Bool RegisterBoundingBoxObject()
if (!bmp)
return false;

return RegisterObjectPlugin(PID_OBOUNDINGBOX, "BoundingBox"_s, OBJECT_GENERATOR | OBJECT_INPUT,
BoundingBoxObject::Alloc, "oboundingbox"_s, bmp, 0, OBJECTCATEGORY::GENERATOR);
finally
{
// bitmap is copied inside RegisterObjectPlugin
BaseBitmap::Free(bmp);
};

if (!RegisterObjectPlugin(PID_OBOUNDINGBOX, "BoundingBox"_s, OBJECT_GENERATOR | OBJECT_INPUT, BoundingBoxObject::Alloc, "oboundingbox"_s, bmp, 0, OBJECTCATEGORY::GENERATOR))
return false;

return true;
}

NodeData* BoundingBoxObject::Alloc()
Expand Down Expand Up @@ -162,7 +170,7 @@ Bool BoundingBoxObject::Init(GeListNode* node, Bool isCloneInit)
{
// We should use C++ style casts instead of C style casts.
BaseObject* obj = static_cast<BaseObject*>(node);
BaseContainer bc = obj->GetDataInstanceRef();
BaseContainer& bc = obj->GetDataInstanceRef();

// In 2024.0 the #isCloneInit argument has been added to throttle initialization overhead for
// cloned scene elements. The data container values will be copied right after this
Expand Down
5 changes: 5 additions & 0 deletions plugins/example.nodes/source/space/nodematerialimport_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class ExampleNodeMaterialImport : public maxon::Component<ExampleNodeMaterialImp

MAXON_METHOD maxon::Result<void> Import(maxon::nodes::NodesGraphModelRef& graph, const maxon::material::MaterialExchangeData& materialData, BaseDocument& baseDocument);

MAXON_METHOD maxon::Result<void> ImportExtended(maxon::nodes::NodesGraphModelRef& graph, const maxon::material::MaterialExchangeDataExtended& materialData, BaseDocument& baseDocument)
{
return self.Import(graph, reinterpret_cast<const maxon::material::MaterialExchangeData&>(materialData), baseDocument);
}

private:
static BaseList2D* FindSubstanceAsset(BaseDocument& baseDocument, const String& assetName);
};
Expand Down

0 comments on commit 55bd2ff

Please sign in to comment.