GitHub PullRequestReviewCommentEvent at 2014-03-20 23:44:40
Repository: moai-dev
Actor: kstenerud
Payload: {"comment":{"url":"https://api.github.com/repos/mindsnacks/moai-dev/pulls/comments/10822483","id":10822483,"diff_hunk":"@@ -748,6 +748,63 @@ void MOAIParticlePexPlugin::_renderRadialScript( float* particle, float* registe\n \n }\n \n+#define TRY_INTERPRETING_AS_NUMERIC(PROPERTY_NAME, MEMBER_NAME) \\\n+if (strcmp(name, #PROPERTY_NAME) == 0) { \\\n+\tMEMBER_NAME = (typeof(MEMBER_NAME))state.GetValue < float >( 3, 0 ); \\\n+}\n+\n+#define TRY_INTERPRETING_AS_COLOR(PROPERTY_NAME, MEMBER_NAME, DEFAULT_ALPHA_VALUE) \\\n+if (strcmp(name, #PROPERTY_NAME) == 0) { \\\n+\tMEMBER_NAME[0] = (float)state.GetValue < float >( 3, 0 ); \\\n+\tMEMBER_NAME[1] = (float)state.GetValue < float >( 4, 0 ); \\\n+\tMEMBER_NAME[2] = (float)state.GetValue < float >( 5, 0 ); \\\n+\tMEMBER_NAME[3] = (float)state.GetValue < float >( 6, DEFAULT_ALPHA_VALUE ); \\\n+}\n+\n+#define TRY_INTERPRETING_AS_COORD(PROPERTY_NAME, MEMBER_NAME) \\\n+if (strcmp(name, #PROPERTY_NAME) == 0) { \\\n+\tMEMBER_NAME[0] = (float)state.GetValue < float >( 3, 0 ); \\\n+\tMEMBER_NAME[1] = (float)state.GetValue < float >( 4, 0 ); \\\n+}\n+\n+void MOAIParticlePexPlugin::SetProperty\t(cc8* name, MOAILuaState &state)\n+{\n+\tTRY_INTERPRETING_AS_NUMERIC      (angle,                      mAngle)\n+\telse TRY_INTERPRETING_AS_NUMERIC (angleVariance,              mAngleVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (blendFuncSource,            mBlendFuncSrc)\n+\telse TRY_INTERPRETING_AS_NUMERIC (blendFuncDestination,       mBlendFuncDst)\n+\telse TRY_INTERPRETING_AS_NUMERIC (duration,                   mDuration)\n+\telse TRY_INTERPRETING_AS_NUMERIC (emitterType,                mEmitterType)\n+\telse TRY_INTERPRETING_AS_COLOR   (finishColor,                mFinishColor, 1)\n+\telse TRY_INTERPRETING_AS_COLOR   (finishColorVariance,        mFinishColorVariance, 0)\n+\telse TRY_INTERPRETING_AS_NUMERIC (finishParticleSize,         mFinishSize)\n+\telse TRY_INTERPRETING_AS_NUMERIC (FinishParticleSizeVariance, mFinishSizeVariance)\n+\telse TRY_INTERPRETING_AS_COORD   (gravity,                    mGravity)\n+\telse TRY_INTERPRETING_AS_NUMERIC (maxParticles,               mNumParticles)\n+\telse TRY_INTERPRETING_AS_NUMERIC (maxRadius,                  mMaxRadius)\n+\telse TRY_INTERPRETING_AS_NUMERIC (maxRadiusVariance,          mMaxRadiusVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (minRadius,                  mMinRadius)\n+\telse TRY_INTERPRETING_AS_NUMERIC (particleLifeSpan,           mLifespan)\n+\telse TRY_INTERPRETING_AS_NUMERIC (particleLifespanVariance,   mLifespanVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (radialAcceleration,         mRadialAcceleration)\n+\telse TRY_INTERPRETING_AS_NUMERIC (radialAccelVariance,        mRadialAccelVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (rotatePerSecond,            mRotPerSecond)\n+\telse TRY_INTERPRETING_AS_NUMERIC (rotatePerSecondVariance,    mRotPerSecondVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (rotationEnd,                mRotEnd)\n+\telse TRY_INTERPRETING_AS_NUMERIC (rotationEndVariance,        mRotEndVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (rotationStart,              mRotStart)\n+\telse TRY_INTERPRETING_AS_COORD   (sourcePosition,             mSourcePos)\n+\telse TRY_INTERPRETING_AS_COORD   (sourcePositionVariance,     mSourcePosVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (speed,                      mSpeed)\n+\telse TRY_INTERPRETING_AS_NUMERIC (speedVariance,              mSpeedVariance)\n+\telse TRY_INTERPRETING_AS_COLOR   (startColor,                 mStartColor, 1)\n+\telse TRY_INTERPRETING_AS_COLOR   (startColorVariance,         mStartColorVariance, 0)\n+\telse TRY_INTERPRETING_AS_NUMERIC (startParticleSize,          mStartSize)\n+\telse TRY_INTERPRETING_AS_NUMERIC (startParticleSizeVariance,  mStartSizeVariance)\n+\telse TRY_INTERPRETING_AS_NUMERIC (tangentialAcceleration,     mTanAccel)\n+\telse TRY_INTERPRETING_AS_NUMERIC (tangentialAccelVariance,    mTanAccelVariance)\n+}","path":"src/moaicore/MOAIParticlePexPlugin.cpp","position":59,"original_position":59,"commit_id":"8feb9683e663ffc3de6b96752a4a6de7fc9a6a19","original_commit_id":"8feb9683e663ffc3de6b96752a4a6de7fc9a6a19","user":{"login":"kstenerud","id":245857,"avatar_url":"https://avatars.githubusercontent.com/u/245857?","gravatar_id":"0479a8c7ebd088dbcf459147ba3b2569","url":"https://api.github.com/users/kstenerud","html_url":"https://github.com/kstenerud","followers_url":"https://api.github.com/users/kstenerud/followers","following_url":"https://api.github.com/users/kstenerud/following{/other_user}","gists_url":"https://api.github.com/users/kstenerud/gists{/gist_id}","starred_url":"https://api.github.com/users/kstenerud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kstenerud/subscriptions","organizations_url":"https://api.github.com/users/kstenerud/orgs","repos_url":"https://api.github.com/users/kstenerud/repos","events_url":"https://api.github.com/users/kstenerud/events{/privacy}","received_events_url":"https://api.github.com/users/kstenerud/received_events","type":"User","site_admin":false},"body":"Could do that, but it would be breaking from the established style for creating individual properties. I had only done it here because it was all self-contained to a single function, and thus fair game.\r\n\r\nI do wish they had implemented properties with macros, though. It would have been a LOT cleaner and they wouldn't have ended up with all these asymmetries between getter/setter.\r\n","created_at":"2014-03-20T23:44:40Z","updated_at":"2014-03-20T23:44:40Z","html_url":"https://github.com/mindsnacks/moai-dev/pull/71#discussion_r10822483","pull_request_url":"https://api.github.com/repos/mindsnacks/moai-dev/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/mindsnacks/moai-dev/pulls/comments/10822483"},"html":{"href":"https://github.com/mindsnacks/moai-dev/pull/71#discussion_r10822483"},"pull_request":{"href":"https://api.github.com/repos/mindsnacks/moai-dev/pulls/71"}}}}