Skip to content

Commit

Permalink
Updating coding conventions documentation, removing executable bit fr…
Browse files Browse the repository at this point in the history
…om source files and running clang format 9 again. (#406)
  • Loading branch information
sirpalee authored May 4, 2020
1 parent 1151194 commit 9e511c4
Show file tree
Hide file tree
Showing 29 changed files with 44 additions and 47 deletions.
2 changes: 1 addition & 1 deletion clang_format
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ else
CLANG_FORMAT="${ARNOLD_USD_CLANG_FORMAT}"
fi

find $SUBFOLDER \( -path './cmake-build-*' -o -path './schemas/build' -o -path ./build \) -prune -o -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)' -exec echo Formatting: {} \; -exec $CLANG_FORMAT -style=file -i {} \;
find $SUBFOLDER \( -path './cmake-*' -o -path './schemas/build' -o -path ./build \) -prune -o -regex '.*\.\(c\|cpp\|cxx\|h\|hpp\|hxx\)' -exec echo Formatting: {} \; -exec $CLANG_FORMAT -style=file -i {} \;
2 changes: 1 addition & 1 deletion docs/conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ comments or file names, this means no accents and special characters.

For Python, generally follow the [PEP-8 guidelines](http://www.python.org/dev/peps/pep-0008/).

Use the supplied .clang-format (for clang format 7) and the scripts to format the codebase.
Use the supplied .clang-format using clang-format 9.0.1 to format the codebase.

## File names

Expand Down
Empty file modified procedural/main.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/instancer.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/light.cpp
100755 → 100644
Empty file.
17 changes: 6 additions & 11 deletions render_delegate/material.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,12 @@ RemapNodeFunc stringPrimvarRemap = [](MaterialEditContext* ctx) {
ctx->RenameParam(str::t_fallback, str::t_defaultStr);
};

const std::unordered_map<TfToken, RemapNodeFunc, TfToken::HashFunctor> nodeRemapFuncs {
{str::t_UsdPreviewSurface, previewSurfaceRemap},
{str::t_UsdUVTexture, uvTextureRemap},
{str::t_UsdPrimvarReader_float, floatPrimvarRemap},
{str::t_UsdPrimvarReader_float2, float2PrimvarRemap},
{str::t_UsdPrimvarReader_float3, float3PrimvarRemap},
{str::t_UsdPrimvarReader_point, float3PrimvarRemap},
{str::t_UsdPrimvarReader_normal, float3PrimvarRemap},
{str::t_UsdPrimvarReader_vector, float3PrimvarRemap},
{str::t_UsdPrimvarReader_float4, float4PrimvarRemap},
{str::t_UsdPrimvarReader_int, intPrimvarRemap},
const std::unordered_map<TfToken, RemapNodeFunc, TfToken::HashFunctor> nodeRemapFuncs{
{str::t_UsdPreviewSurface, previewSurfaceRemap}, {str::t_UsdUVTexture, uvTextureRemap},
{str::t_UsdPrimvarReader_float, floatPrimvarRemap}, {str::t_UsdPrimvarReader_float2, float2PrimvarRemap},
{str::t_UsdPrimvarReader_float3, float3PrimvarRemap}, {str::t_UsdPrimvarReader_point, float3PrimvarRemap},
{str::t_UsdPrimvarReader_normal, float3PrimvarRemap}, {str::t_UsdPrimvarReader_vector, float3PrimvarRemap},
{str::t_UsdPrimvarReader_float4, float4PrimvarRemap}, {str::t_UsdPrimvarReader_int, intPrimvarRemap},
{str::t_UsdPrimvarReader_string, stringPrimvarRemap},
};

Expand Down
2 changes: 1 addition & 1 deletion render_delegate/mesh.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ inline void _ConvertFaceVaryingPrimvarToBuiltin(
AiNodeSetArray(node, arnoldIndexName, HdArnoldGenerateIdxs(numValues, vertexCounts));
}

}
} // namespace

HdArnoldMesh::HdArnoldMesh(HdArnoldRenderDelegate* delegate, const SdfPath& id, const SdfPath& instancerId)
: HdMesh(id, instancerId), _shape(str::polymesh, delegate, id, GetPrimId())
Expand Down
Empty file modified render_delegate/nodes/driver.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/nodes/nodes.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/openvdb_asset.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/points.cpp
100755 → 100644
Empty file.
5 changes: 3 additions & 2 deletions render_delegate/render_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ inline void _WriteBucket(
const auto toStep = width * componentCount;
const auto fromStep = bucketWidth * bucketComponentCount;

const auto copyOp = [](const typename HdFormatType<FROM>::type& in) -> typename HdFormatType<TO>::type {
const auto copyOp = [](const typename HdFormatType<FROM>::type& in) -> typename HdFormatType<TO>::type
{
return _ConvertType<typename HdFormatType<TO>::type, typename HdFormatType<FROM>::type>(in);
};
const auto dataWidth = xe - xo;
Expand Down Expand Up @@ -162,7 +163,7 @@ using WriteBucketFunction = void (*)(

using WriteBucketFunctionMap = std::unordered_map<ConversionKey, WriteBucketFunction, ConversionKey::HashFunctor>;

WriteBucketFunctionMap writeBucketFunctions {
WriteBucketFunctionMap writeBucketFunctions{
// Write to UNorm8 format.
{{HdFormatUNorm8, HdFormatSNorm8}, _WriteBucket<HdFormatUNorm8, HdFormatSNorm8>},
{{HdFormatUNorm8, HdFormatFloat16}, _WriteBucket<HdFormatUNorm8, HdFormatFloat16>},
Expand Down
Empty file modified render_delegate/render_delegate.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/render_param.cpp
100755 → 100644
Empty file.
7 changes: 3 additions & 4 deletions render_delegate/render_pass.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ HdArnoldRenderPass::HdArnoldRenderPass(
AiNodeSetPtr(_driver, str::aov_pointer, &_renderBuffers);

// Even though we are not displaying the prim id buffer, we still need it to detect background pixels.
_fallbackBuffers = {
{HdAovTokens->color, &_fallbackColor},
{HdAovTokens->depth, &_fallbackDepth},
{HdAovTokens->primId, &_fallbackPrimId}};
_fallbackBuffers = {{HdAovTokens->color, &_fallbackColor},
{HdAovTokens->depth, &_fallbackDepth},
{HdAovTokens->primId, &_fallbackPrimId}};
_fallbackOutputs = AiArrayAllocate(3, 1, AI_TYPE_STRING);
// Setting up the fallback outputs when no
const auto beautyString = TfStringPrintf("RGBA RGBA %s %s", AiNodeGetName(_beautyFilter), AiNodeGetName(_driver));
Expand Down
Empty file modified render_delegate/shape.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/utils.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/volume.cpp
100755 → 100644
Empty file.
Empty file modified render_delegate/volume.h
100755 → 100644
Empty file.
43 changes: 21 additions & 22 deletions testsuite/test_0038/data/test.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
#include <ai.h>

#include <cstring>
#include <cstdio>
#include <cstring>
#include <iostream>

int main(int argc, char **argv)
{
AiMsgSetConsoleFlags(AI_LOG_ALL);
AiBegin();
AiMsgSetConsoleFlags(AI_LOG_ALL);
AiBegin();

AtUniverse *proc_universe = AiUniverse();

AiASSLoad("scene.ass");
// load the usd procedural (containing a sphere) in a separate universe
AiASSLoad(proc_universe, "usd_proc.ass");
AtNode *proc_a = AiNode(proc_universe, "usd", "usd_proc_a");
AiNodeSetStr(proc_a, "filename", "usd_proc_a.usda");
// Call the viewport API on the usd procedural, and fill the main universe
AiProceduralViewport(proc_a, nullptr, AI_PROC_POLYGONS);
AtNode *proc_b = AiNode(proc_universe, "usd", "usd_proc_b");
AiNodeSetStr(proc_b, "filename", "usd_proc_b.usda");
// Call the viewport API on the usd procedural, and fill the main universe
AiProceduralViewport(proc_b, nullptr, AI_PROC_BOXES);

AtUniverse *proc_universe = AiUniverse();

AiASSLoad("scene.ass");
// load the usd procedural (containing a sphere) in a separate universe
AiASSLoad(proc_universe, "usd_proc.ass");
AtNode *proc_a = AiNode(proc_universe, "usd", "usd_proc_a");
AiNodeSetStr(proc_a, "filename", "usd_proc_a.usda");
// Call the viewport API on the usd procedural, and fill the main universe
AiProceduralViewport(proc_a, nullptr, AI_PROC_POLYGONS);
AtNode *proc_b = AiNode(proc_universe, "usd", "usd_proc_b");
AiNodeSetStr(proc_b, "filename", "usd_proc_b.usda");
// Call the viewport API on the usd procedural, and fill the main universe
AiProceduralViewport(proc_b, nullptr, AI_PROC_BOXES);

AiUniverseDestroy(proc_universe);
AiRender();
AiUniverseDestroy(proc_universe);
AiRender();

AiEnd();
return 0;

AiEnd();
return 0;
}
3 changes: 2 additions & 1 deletion testsuite/test_0039/data/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ TEST(HdArnoldRenderBuffer, ConvertingValues)
}
}

int main(int argc, char** argv) {
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
3 changes: 2 additions & 1 deletion testsuite/test_0044/data/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ TEST(NdrArnoldParserPlugin, GetDiscoveryTypes)
EXPECT_EQ(plugin.GetDiscoveryTypes(), NdrTokenVec{TfToken("arnold")});
}

int main(int argc, char** argv) {
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
7 changes: 4 additions & 3 deletions testsuite/test_0045/data/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ TEST(TokenizePath, TokenizePath)
{
std::vector<std::string> tokens;
TokenizePath("/a;/b", tokens, ";", false);
const std::vector<std::string> result1 {"/a", "/b"};
const std::vector<std::string> result1{"/a", "/b"};
EXPECT_EQ(tokens, result1);
tokens.clear();
TokenizePath("/a/b", tokens, ";", false);
const std::vector<std::string> result2 {"/a/b"};
const std::vector<std::string> result2{"/a/b"};
EXPECT_EQ(tokens, result2);
}

Expand All @@ -46,7 +46,8 @@ TEST(UsdArnoldWriterRegistry, UsdArnoldWriterRegistry)
}
}

int main(int argc, char** argv) {
int main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Empty file modified translator/reader/read_light.cpp
100755 → 100644
Empty file.
Empty file modified translator/reader/read_shader.cpp
100755 → 100644
Empty file.
Empty file modified translator/reader/reader.h
100755 → 100644
Empty file.
Empty file modified translator/reader/utils.cpp
100755 → 100644
Empty file.
Empty file modified translator/utils/utils.h
100755 → 100644
Empty file.
Empty file modified translator/writer/write_arnold_type.cpp
100755 → 100644
Empty file.

0 comments on commit 9e511c4

Please sign in to comment.