{"action":"created","comment":{"url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/comments/109757529","pull_request_review_id":30880221,"id":109757529,"diff_hunk":"@@ -0,0 +1,155 @@\n+//////////////////////////////////////////////////////////////////////////\n+//\n+//  Copyright (c) 2016, Image Engine Design Inc. All rights reserved.\n+//\n+//  Redistribution and use in source and binary forms, with or without\n+//  modification, are permitted provided that the following conditions are\n+//  met:\n+//\n+//      * Redistributions of source code must retain the above\n+//        copyright notice, this list of conditions and the following\n+//        disclaimer.\n+//\n+//      * Redistributions in binary form must reproduce the above\n+//        copyright notice, this list of conditions and the following\n+//        disclaimer in the documentation and/or other materials provided with\n+//        the distribution.\n+//\n+//      * Neither the name of John Haddon nor the names of\n+//        any other contributors to this software may be used to endorse or\n+//        promote products derived from this software without specific prior\n+//        written permission.\n+//\n+//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n+//  IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n+//  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n+//  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n+//  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n+//  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n+//  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n+//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n+//  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n+//  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n+//  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+//\n+//////////////////////////////////////////////////////////////////////////\n+\n+#include \"IECore/MeshPrimitive.h\"\n+#include \"IECore/MeshAlgo.h\"\n+\n+#include \"GafferScene/MeshTangents.h\"\n+\n+using namespace IECore;\n+using namespace Gaffer;\n+using namespace GafferScene;\n+\n+IE_CORE_DEFINERUNTIMETYPED( MeshTangents );\n+\n+size_t MeshTangents::g_firstPlugIndex = 0;\n+\n+MeshTangents::MeshTangents( const std::string &name ) : SceneElementProcessor( name )\n+{\n+\tstoreIndexOfNextChild( g_firstPlugIndex );\n+\taddChild( new StringPlug( \"uvSet\", Plug::In, \"st\" ) );\n+\taddChild( new StringPlug( \"posPrimVarName\", Plug::In, \"P\" ) );\n+\taddChild( new BoolPlug( \"orthogonal\", Plug::In, true ) );\n+\n+\t// Fast pass-throughs for things we don't modify\n+\toutPlug()->attributesPlug()->setInput( inPlug()->attributesPlug() );\n+\toutPlug()->transformPlug()->setInput( inPlug()->transformPlug() );\n+}\n+\n+MeshTangents::~MeshTangents()\n+{\n+}\n+\n+Gaffer::StringPlug *MeshTangents::uvSetPlug()\n+{\n+\treturn getChild<StringPlug>( g_firstPlugIndex );\n+}\n+\n+const Gaffer::StringPlug *MeshTangents::uvSetPlug() const\n+{\n+\treturn getChild<StringPlug>( g_firstPlugIndex );\n+}\n+\n+Gaffer::StringPlug *MeshTangents::posPrimVarNamePlug()\n+{\n+\treturn getChild<StringPlug>( g_firstPlugIndex + 1 );\n+}\n+\n+const Gaffer::StringPlug *MeshTangents::posPrimVarNamePlug() const\n+{\n+\treturn getChild<StringPlug>( g_firstPlugIndex + 1 );\n+}\n+\n+Gaffer::BoolPlug *MeshTangents::orthogonalPlug()\n+{\n+\treturn getChild<BoolPlug>( g_firstPlugIndex + 2 );\n+}\n+\n+const Gaffer::BoolPlug *MeshTangents::orthogonalPlug() const\n+{\n+\treturn getChild<BoolPlug>( g_firstPlugIndex + 2 );\n+}\n+\n+void MeshTangents::affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const\n+{\n+\tSceneElementProcessor::affects( input, outputs );\n+\n+\tif( input == uvSetPlug() || input == posPrimVarNamePlug() || input == orthogonalPlug() )\n+\t{\n+\t\toutputs.push_back( outPlug()->objectPlug() );\n+\t}\n+\telse if( input == outPlug()->objectPlug() )\n+\t{\n+\t\toutputs.push_back( outPlug()->boundPlug() );\n+\t}\n+}\n+\n+bool MeshTangents::processesBound() const\n+{\n+\treturn true;\n+}\n+\n+void MeshTangents::hashProcessedBound( const ScenePath &path, const Gaffer::Context *context, IECore::MurmurHash &h ) const\n+{\n+\thashProcessedObject( path, context, h );\n+}\n+\n+Imath::Box3f MeshTangents::computeProcessedBound( const ScenePath &path, const Gaffer::Context *context, const Imath::Box3f &inputBound ) const\n+{\n+\treturn inputBound;\n+}\n+\n+bool MeshTangents::processesObject() const\n+{\n+\treturn true;\n+}\n+\n+void MeshTangents::hashProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::MurmurHash &h ) const\n+{\n+\tuvSetPlug()->hash( h );\n+\tposPrimVarNamePlug()->hash( h );\n+\torthogonalPlug()->hash( h );\n+}\n+\n+IECore::ConstObjectPtr MeshTangents::computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::ConstObjectPtr inputObject ) const\n+{\n+\tconst MeshPrimitive *mesh = runTimeCast<const MeshPrimitive>( inputObject.get() );\n+\tif( !mesh )\n+\t{\n+\t\treturn inputObject;\n+\t}\n+\n+\tstd::string uvSet = uvSetPlug()->getValue();\n+\tstd::string posPrimVarName = posPrimVarNamePlug()->getValue();\n+\tbool ortho = orthogonalPlug()->getValue();\n+\n+\tstd::pair<PrimitiveVariable, PrimitiveVariable> tangentPrimvars = MeshAlgo::calculateTangents( mesh, uvSet, ortho, posPrimVarName);\n+\tMeshPrimitivePtr meshWithTangents = runTimeCast<MeshPrimitive>( mesh->copy() );\n+\n+\tmeshWithTangents->variables[\"Tangent\"] = tangentPrimvars.first;","path":"src/GafferScene/MeshTangents.cpp","position":152,"original_position":152,"commit_id":"7180c40f608f4be8e3c5d9246ec96b7268c8e141","original_commit_id":"7180c40f608f4be8e3c5d9246ec96b7268c8e141","user":{"login":"johnhaddon","id":1133871,"avatar_url":"https://avatars3.githubusercontent.com/u/1133871?v=3","gravatar_id":"","url":"https://api.github.com/users/johnhaddon","html_url":"https://github.com/johnhaddon","followers_url":"https://api.github.com/users/johnhaddon/followers","following_url":"https://api.github.com/users/johnhaddon/following{/other_user}","gists_url":"https://api.github.com/users/johnhaddon/gists{/gist_id}","starred_url":"https://api.github.com/users/johnhaddon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnhaddon/subscriptions","organizations_url":"https://api.github.com/users/johnhaddon/orgs","repos_url":"https://api.github.com/users/johnhaddon/repos","events_url":"https://api.github.com/users/johnhaddon/events{/privacy}","received_events_url":"https://api.github.com/users/johnhaddon/received_events","type":"User","site_admin":false},"body":"Or are those names bad because they shadow a standard renderer generated primvar in RenderMan?","created_at":"2017-04-04T19:36:38Z","updated_at":"2017-04-04T19:36:39Z","html_url":"https://github.com/GafferHQ/gaffer/pull/2028#discussion_r109757529","pull_request_url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028","_links":{"self":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/comments/109757529"},"html":{"href":"https://github.com/GafferHQ/gaffer/pull/2028#discussion_r109757529"},"pull_request":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028"}}},"pull_request":{"url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028","id":114210143,"html_url":"https://github.com/GafferHQ/gaffer/pull/2028","diff_url":"https://github.com/GafferHQ/gaffer/pull/2028.diff","patch_url":"https://github.com/GafferHQ/gaffer/pull/2028.patch","issue_url":"https://api.github.com/repos/GafferHQ/gaffer/issues/2028","number":2028,"state":"open","locked":false,"title":"MeshTangents : node to add Tangent & Binormal to a mesh","user":{"login":"donboie","id":25311256,"avatar_url":"https://avatars2.githubusercontent.com/u/25311256?v=3","gravatar_id":"","url":"https://api.github.com/users/donboie","html_url":"https://github.com/donboie","followers_url":"https://api.github.com/users/donboie/followers","following_url":"https://api.github.com/users/donboie/following{/other_user}","gists_url":"https://api.github.com/users/donboie/gists{/gist_id}","starred_url":"https://api.github.com/users/donboie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donboie/subscriptions","organizations_url":"https://api.github.com/users/donboie/orgs","repos_url":"https://api.github.com/users/donboie/repos","events_url":"https://api.github.com/users/donboie/events{/privacy}","received_events_url":"https://api.github.com/users/donboie/received_events","type":"User","site_admin":false},"body":"depends on MeshAlgo in Cortex:\r\nhttps://github.com/ImageEngine/cortex/pull/556","created_at":"2017-04-04T18:09:41Z","updated_at":"2017-04-04T19:36:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f34242d3cd59600cdedba6161887682224115c79","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028/commits","review_comments_url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028/comments","review_comment_url":"https://api.github.com/repos/GafferHQ/gaffer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GafferHQ/gaffer/issues/2028/comments","statuses_url":"https://api.github.com/repos/GafferHQ/gaffer/statuses/7180c40f608f4be8e3c5d9246ec96b7268c8e141","head":{"label":"donboie:tangentNode","ref":"tangentNode","sha":"7180c40f608f4be8e3c5d9246ec96b7268c8e141","user":{"login":"donboie","id":25311256,"avatar_url":"https://avatars2.githubusercontent.com/u/25311256?v=3","gravatar_id":"","url":"https://api.github.com/users/donboie","html_url":"https://github.com/donboie","followers_url":"https://api.github.com/users/donboie/followers","following_url":"https://api.github.com/users/donboie/following{/other_user}","gists_url":"https://api.github.com/users/donboie/gists{/gist_id}","starred_url":"https://api.github.com/users/donboie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donboie/subscriptions","organizations_url":"https://api.github.com/users/donboie/orgs","repos_url":"https://api.github.com/users/donboie/repos","events_url":"https://api.github.com/users/donboie/events{/privacy}","received_events_url":"https://api.github.com/users/donboie/received_events","type":"User","site_admin":false},"repo":{"id":80573777,"name":"gaffer","full_name":"donboie/gaffer","owner":{"login":"donboie","id":25311256,"avatar_url":"https://avatars2.githubusercontent.com/u/25311256?v=3","gravatar_id":"","url":"https://api.github.com/users/donboie","html_url":"https://github.com/donboie","followers_url":"https://api.github.com/users/donboie/followers","following_url":"https://api.github.com/users/donboie/following{/other_user}","gists_url":"https://api.github.com/users/donboie/gists{/gist_id}","starred_url":"https://api.github.com/users/donboie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donboie/subscriptions","organizations_url":"https://api.github.com/users/donboie/orgs","repos_url":"https://api.github.com/users/donboie/repos","events_url":"https://api.github.com/users/donboie/events{/privacy}","received_events_url":"https://api.github.com/users/donboie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/donboie/gaffer","description":"Gaffer is an open source application framework designed specifically for creating tools for use in visual effects production.","fork":true,"url":"https://api.github.com/repos/donboie/gaffer","forks_url":"https://api.github.com/repos/donboie/gaffer/forks","keys_url":"https://api.github.com/repos/donboie/gaffer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/donboie/gaffer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/donboie/gaffer/teams","hooks_url":"https://api.github.com/repos/donboie/gaffer/hooks","issue_events_url":"https://api.github.com/repos/donboie/gaffer/issues/events{/number}","events_url":"https://api.github.com/repos/donboie/gaffer/events","assignees_url":"https://api.github.com/repos/donboie/gaffer/assignees{/user}","branches_url":"https://api.github.com/repos/donboie/gaffer/branches{/branch}","tags_url":"https://api.github.com/repos/donboie/gaffer/tags","blobs_url":"https://api.github.com/repos/donboie/gaffer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/donboie/gaffer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/donboie/gaffer/git/refs{/sha}","trees_url":"https://api.github.com/repos/donboie/gaffer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/donboie/gaffer/statuses/{sha}","languages_url":"https://api.github.com/repos/donboie/gaffer/languages","stargazers_url":"https://api.github.com/repos/donboie/gaffer/stargazers","contributors_url":"https://api.github.com/repos/donboie/gaffer/contributors","subscribers_url":"https://api.github.com/repos/donboie/gaffer/subscribers","subscription_url":"https://api.github.com/repos/donboie/gaffer/subscription","commits_url":"https://api.github.com/repos/donboie/gaffer/commits{/sha}","git_commits_url":"https://api.github.com/repos/donboie/gaffer/git/commits{/sha}","comments_url":"https://api.github.com/repos/donboie/gaffer/comments{/number}","issue_comment_url":"https://api.github.com/repos/donboie/gaffer/issues/comments{/number}","contents_url":"https://api.github.com/repos/donboie/gaffer/contents/{+path}","compare_url":"https://api.github.com/repos/donboie/gaffer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/donboie/gaffer/merges","archive_url":"https://api.github.com/repos/donboie/gaffer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/donboie/gaffer/downloads","issues_url":"https://api.github.com/repos/donboie/gaffer/issues{/number}","pulls_url":"https://api.github.com/repos/donboie/gaffer/pulls{/number}","milestones_url":"https://api.github.com/repos/donboie/gaffer/milestones{/number}","notifications_url":"https://api.github.com/repos/donboie/gaffer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/donboie/gaffer/labels{/name}","releases_url":"https://api.github.com/repos/donboie/gaffer/releases{/id}","deployments_url":"https://api.github.com/repos/donboie/gaffer/deployments","created_at":"2017-01-31T23:41:58Z","updated_at":"2017-01-31T23:42:06Z","pushed_at":"2017-04-04T18:08:48Z","git_url":"git://github.com/donboie/gaffer.git","ssh_url":"git@github.com:donboie/gaffer.git","clone_url":"https://github.com/donboie/gaffer.git","svn_url":"https://github.com/donboie/gaffer","homepage":"http://www.gafferhq.org","size":25943,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GafferHQ:master","ref":"master","sha":"6d9c7d45c2f1be2fe8d2ae05da7f4712c970d05b","user":{"login":"GafferHQ","id":20556043,"avatar_url":"https://avatars2.githubusercontent.com/u/20556043?v=3","gravatar_id":"","url":"https://api.github.com/users/GafferHQ","html_url":"https://github.com/GafferHQ","followers_url":"https://api.github.com/users/GafferHQ/followers","following_url":"https://api.github.com/users/GafferHQ/following{/other_user}","gists_url":"https://api.github.com/users/GafferHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/GafferHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GafferHQ/subscriptions","organizations_url":"https://api.github.com/users/GafferHQ/orgs","repos_url":"https://api.github.com/users/GafferHQ/repos","events_url":"https://api.github.com/users/GafferHQ/events{/privacy}","received_events_url":"https://api.github.com/users/GafferHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":9043124,"name":"gaffer","full_name":"GafferHQ/gaffer","owner":{"login":"GafferHQ","id":20556043,"avatar_url":"https://avatars2.githubusercontent.com/u/20556043?v=3","gravatar_id":"","url":"https://api.github.com/users/GafferHQ","html_url":"https://github.com/GafferHQ","followers_url":"https://api.github.com/users/GafferHQ/followers","following_url":"https://api.github.com/users/GafferHQ/following{/other_user}","gists_url":"https://api.github.com/users/GafferHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/GafferHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GafferHQ/subscriptions","organizations_url":"https://api.github.com/users/GafferHQ/orgs","repos_url":"https://api.github.com/users/GafferHQ/repos","events_url":"https://api.github.com/users/GafferHQ/events{/privacy}","received_events_url":"https://api.github.com/users/GafferHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GafferHQ/gaffer","description":"Gaffer is an open source application framework designed specifically for creating tools for use in visual effects production.","fork":false,"url":"https://api.github.com/repos/GafferHQ/gaffer","forks_url":"https://api.github.com/repos/GafferHQ/gaffer/forks","keys_url":"https://api.github.com/repos/GafferHQ/gaffer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GafferHQ/gaffer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GafferHQ/gaffer/teams","hooks_url":"https://api.github.com/repos/GafferHQ/gaffer/hooks","issue_events_url":"https://api.github.com/repos/GafferHQ/gaffer/issues/events{/number}","events_url":"https://api.github.com/repos/GafferHQ/gaffer/events","assignees_url":"https://api.github.com/repos/GafferHQ/gaffer/assignees{/user}","branches_url":"https://api.github.com/repos/GafferHQ/gaffer/branches{/branch}","tags_url":"https://api.github.com/repos/GafferHQ/gaffer/tags","blobs_url":"https://api.github.com/repos/GafferHQ/gaffer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GafferHQ/gaffer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GafferHQ/gaffer/git/refs{/sha}","trees_url":"https://api.github.com/repos/GafferHQ/gaffer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GafferHQ/gaffer/statuses/{sha}","languages_url":"https://api.github.com/repos/GafferHQ/gaffer/languages","stargazers_url":"https://api.github.com/repos/GafferHQ/gaffer/stargazers","contributors_url":"https://api.github.com/repos/GafferHQ/gaffer/contributors","subscribers_url":"https://api.github.com/repos/GafferHQ/gaffer/subscribers","subscription_url":"https://api.github.com/repos/GafferHQ/gaffer/subscription","commits_url":"https://api.github.com/repos/GafferHQ/gaffer/commits{/sha}","git_commits_url":"https://api.github.com/repos/GafferHQ/gaffer/git/commits{/sha}","comments_url":"https://api.github.com/repos/GafferHQ/gaffer/comments{/number}","issue_comment_url":"https://api.github.com/repos/GafferHQ/gaffer/issues/comments{/number}","contents_url":"https://api.github.com/repos/GafferHQ/gaffer/contents/{+path}","compare_url":"https://api.github.com/repos/GafferHQ/gaffer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GafferHQ/gaffer/merges","archive_url":"https://api.github.com/repos/GafferHQ/gaffer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GafferHQ/gaffer/downloads","issues_url":"https://api.github.com/repos/GafferHQ/gaffer/issues{/number}","pulls_url":"https://api.github.com/repos/GafferHQ/gaffer/pulls{/number}","milestones_url":"https://api.github.com/repos/GafferHQ/gaffer/milestones{/number}","notifications_url":"https://api.github.com/repos/GafferHQ/gaffer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GafferHQ/gaffer/labels{/name}","releases_url":"https://api.github.com/repos/GafferHQ/gaffer/releases{/id}","deployments_url":"https://api.github.com/repos/GafferHQ/gaffer/deployments","created_at":"2013-03-27T00:04:53Z","updated_at":"2017-03-29T05:55:16Z","pushed_at":"2017-04-04T18:53:42Z","git_url":"git://github.com/GafferHQ/gaffer.git","ssh_url":"git@github.com:GafferHQ/gaffer.git","clone_url":"https://github.com/GafferHQ/gaffer.git","svn_url":"https://github.com/GafferHQ/gaffer","homepage":"http://www.gafferhq.org","size":25936,"stargazers_count":271,"watchers_count":271,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":106,"mirror_url":null,"open_issues_count":195,"forks":106,"open_issues":195,"watchers":271,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028"},"html":{"href":"https://github.com/GafferHQ/gaffer/pull/2028"},"issue":{"href":"https://api.github.com/repos/GafferHQ/gaffer/issues/2028"},"comments":{"href":"https://api.github.com/repos/GafferHQ/gaffer/issues/2028/comments"},"review_comments":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028/comments"},"review_comment":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GafferHQ/gaffer/pulls/2028/commits"},"statuses":{"href":"https://api.github.com/repos/GafferHQ/gaffer/statuses/7180c40f608f4be8e3c5d9246ec96b7268c8e141"}}}}
{"actor":{"display_login":"johnhaddon"}}