FloatValue* CPropHelper::CreateAngle (PropItemVec& items, shared_str key, float* val, float mn, float mx, float inc, int decim) { FloatValue* V = (FloatValue*) AppendValue (items,key,xr_new<FloatValue>(val,mn,mx,inc,decim),PROP_NUMERIC); V->OnAfterEditEvent.bind (this,&CPropHelper::floatRDOnAfterEdit); V->OnBeforeEditEvent.bind (this,&CPropHelper::floatRDOnBeforeEdit); V->Owner()->OnDrawTextEvent.bind(this,&CPropHelper::floatRDOnDraw); return V; }
void PS::CPEDef::FillProp(LPCSTR pref, ::PropItemVec& items, ::ListItem* owner) { ButtonValue* B; PropValue* P = 0; B=PHelper().CreateButton (items,PrepareKey(pref,"Control"),"Play(F5),Stop(F6),Stop...(F7)",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&PS::CPEDef::OnControlClick); RTextValue* R = PHelper().CreateRText (items,PrepareKey(pref,"Name"),&m_Name); R->OnAfterEditEvent.bind (this,&PS::CPEDef::NameOnAfterEdit); // max particles PHelper().CreateS32 (items,PrepareKey (pref,"Max Particles"), &m_MaxParticles, 0, 100000); // P->OnChangeEvent = OnFlagChange; // time limit P=PHelper().CreateFlag32(items,PrepareKey (pref,"Time Limit"), &m_Flags, dfTimeLimit); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfTimeLimit)) PHelper().CreateFloat (items,PrepareKey (pref,"Time Limit\\Value (sec)"), &m_fTimeLimit, 0, 10000.f); // sprite P=PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite"), &m_Flags, dfSprite); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfSprite)){ P=PHelper().CreateChoose(items,PrepareKey (pref,"Sprite\\Texture"), &m_TextureName, smTexture, 0,0, 2); P->OnChangeEvent.bind (this,&PS::CPEDef::OnShaderChange); P=PHelper().CreateChoose(items,PrepareKey (pref,"Sprite\\Shader"), &m_ShaderName, smEShader); P->OnChangeEvent.bind (this,&PS::CPEDef::OnShaderChange); // frame P=PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Culling"), &m_Flags, dfCulling); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(CPEDef::dfCulling)) PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Culling\\CCW"), &m_Flags, dfCullCCW); P=PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Frame"), &m_Flags, dfFramed); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfFramed)){ PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Frame\\Random Init"), &m_Flags, dfRandomFrame); PHelper().CreateS32 (items,PrepareKey (pref,"Sprite\\Frame\\Count"), &m_Frame.m_iFrameCount, 1,256); P=PHelper().CreateFloat(items,PrepareKey (pref,"Sprite\\Frame\\Size U (0..1)"), &m_Frame.m_fTexSize.x, EPS_S,1.f,0.001f,8); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFrameResize); PHelper().CreateFloat (items,PrepareKey (pref,"Sprite\\Frame\\Size V (0..1)"), &m_Frame.m_fTexSize.y, EPS_S,1.f,0.001f,8); // animate P=PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Animated"), &m_Flags, dfAnimated); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfAnimated)){ PHelper().CreateFlag32(items,PrepareKey (pref,"Sprite\\Animated\\Random Playback"), &m_Flags, dfRandomPlayback); PHelper().CreateFloat(items,PrepareKey (pref,"Sprite\\Animated\\Speed"), &m_Frame.m_fSpeed, 0.f,1000.f); } } } // align to path P=PHelper().CreateFlag32(items,PrepareKey (pref,"Movement\\Align To Path"), &m_Flags, dfAlignToPath); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfAlignToPath)){ PHelper().CreateFlag32(items,PrepareKey (pref,"Movement\\Align To Path\\Face Align"), &m_Flags, dfFaceAlign); PHelper().CreateFlag32(items,PrepareKey (pref,"Movement\\Align To Path\\Default World Align"), &m_Flags, dfWorldAlign); PHelper().CreateAngle3(items,PrepareKey (pref,"Movement\\Align To Path\\Default Rotate"), &m_APDefaultRotation); } // velocity scale P=PHelper().CreateFlag32(items,PrepareKey (pref,"Movement\\Velocity Scale"), &m_Flags, dfVelocityScale); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); if (m_Flags.is(dfVelocityScale)) PHelper().CreateVector(items,PrepareKey (pref,"Movement\\Velocity Scale\\Value"), &m_VelocityScale, -1000.f, 1000.f); // collision P=PHelper().CreateFlag32(items,PrepareKey (pref,"Movement\\Collision"), &m_Flags, dfCollision); P->OnChangeEvent.bind (this,&PS::CPEDef::OnFlagChange); FloatValue* V = 0; if (m_Flags.is(dfCollision)){ PHelper().CreateFlag32(items,PrepareKey(pref,"Movement\\Collision\\Collide With Dynamic"), &m_Flags, dfCollisionDyn); PHelper().CreateFlag32(items,PrepareKey(pref,"Movement\\Collision\\Destroy On Contact"), &m_Flags, dfCollisionDel); V=PHelper().CreateFloat (items,PrepareKey (pref,"Movement\\Collision\\Friction"), &m_fCollideOneMinusFriction,0.f, 1.f); V->OnBeforeEditEvent.bind (this,&PS::CPEDef::CollisionFrictionOnBeforeEdit); V->OnAfterEditEvent.bind (this,&PS::CPEDef::CollisionFrictionOnAfterEdit); V->Owner()->OnDrawTextEvent.bind(this,&PS::CPEDef::CollisionFrictionOnDraw); PHelper().CreateFloat (items,PrepareKey (pref,"Movement\\Collision\\Resilence"), &m_fCollideResilience, 0.f, 1.f); V=PHelper().CreateFloat (items,PrepareKey (pref,"Movement\\Collision\\Cutoff"), &m_fCollideSqrCutoff, 0.f, P_MAXFLOAT); V->OnBeforeEditEvent.bind (this,&PS::CPEDef::CollisionCutoffOnBeforeEdit); V->OnAfterEditEvent.bind (this,&PS::CPEDef::CollisionCutoffOnAfterEdit); V->Owner()->OnDrawTextEvent.bind(this,&PS::CPEDef::CollisionCutoffOnDraw); } // actions B=::PHelper().CreateButton(items,PrepareKey(pref,"Actions\\Edit"),"Append",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&PS::CPEDef::OnActionsClick); for (EPAVecIt s_it=m_EActionList.begin(); s_it!=m_EActionList.end(); s_it++) { u32 clr = (*s_it)->flags.is(EParticleAction::flEnabled)?clBlack:clSilver; shared_str a_pref = PrepareKey(pref,"Actions",AnsiString().sprintf("%s (%s)",*(*s_it)->actionType,*(*s_it)->actionName).c_str()); ButtonValue* B = PHelper().CreateButton(items,a_pref,"Up,Down,Remove",ButtonValue::flFirstOnly); B->tag = (s_it-m_EActionList.begin()); B->Owner()->prop_color = clr; B->OnBtnClickEvent.bind (this,&PS::CPEDef::OnActionEditClick); RTextValue* R; R=PHelper().CreateRText (items,PrepareKey(a_pref.c_str(),"Name"),&(*s_it)->actionName); R->OnAfterEditEvent.bind(this,&PS::CPEDef::OnAfterActionNameEdit); R->Owner()->prop_color = clr; (*s_it)->FillProp (items,a_pref.c_str(),clr); } }