PolycodeProps.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921
  1. /*
  2. Copyright (C) 2012 by Ivan Safrin
  3. Permission is hereby granted, free of charge, to any person obtaining a copy
  4. of this software and associated documentation files (the "Software"), to deal
  5. in the Software without restriction, including without limitation the rights
  6. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. copies of the Software, and to permit persons to whom the Software is
  8. furnished to do so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in
  10. all copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. THE SOFTWARE.
  18. */
  19. #pragma once
  20. #include "PolycodeGlobals.h"
  21. #include "PolycodeUI.h"
  22. #include "Polycode.h"
  23. #include "OSBasics.h"
  24. #include "PolycodeEditor.h"
  25. using namespace Polycode;
  26. #define PROP_PADDING 40
  27. class PolycodeEditorPropActionData;
  28. class PropProp : public UIElement {
  29. public:
  30. PropProp(String caption, String type);
  31. ~PropProp();
  32. virtual void setPropData(PolycodeEditorPropActionData* data) {}
  33. virtual void setPropWidth(Number width) {}
  34. void setPropName(String newName);
  35. String propType;
  36. UILabel *label;
  37. Entity *propContents;
  38. bool suppressChangeEvent;
  39. bool settingFromData;
  40. };
  41. class Vector3Prop : public PropProp {
  42. public:
  43. Vector3Prop(String caption);
  44. ~Vector3Prop();
  45. void handleEvent(Event *event);
  46. void set(const Vector3 &position);
  47. Vector3 get() const;
  48. void setPropData(PolycodeEditorPropActionData* data);
  49. void setPropWidth(Number width);
  50. UITextInput *xInput;
  51. UITextInput *yInput;
  52. UITextInput *zInput;
  53. UILabel *labelX;
  54. UILabel *labelY;
  55. UILabel *labelZ;
  56. };
  57. class Vector2Prop : public PropProp {
  58. public:
  59. Vector2Prop(String caption);
  60. ~Vector2Prop();
  61. void handleEvent(Event *event);
  62. void set(Vector2 position);
  63. Vector2 get();
  64. void setPropData(PolycodeEditorPropActionData* data);
  65. void setPropWidth(Number width);
  66. UITextInput *positionX;
  67. UITextInput *positionY;
  68. Vector2 lastData;
  69. Vector2 currentData;
  70. UILabel *labelX;
  71. UILabel *labelY;
  72. };
  73. class SliderProp : public PropProp {
  74. public:
  75. SliderProp(String caption, Number min, Number max);
  76. ~SliderProp();
  77. void handleEvent(Event *event);
  78. void set(Number number);
  79. Number get();
  80. void setPropWidth(Number width);
  81. void setPropData(PolycodeEditorPropActionData* data);
  82. UIHSlider *slider;
  83. UILabel *valueLabel;
  84. Number lastValue;
  85. Number currentValue;
  86. };
  87. class ButtonProp : public PropProp {
  88. public:
  89. ButtonProp(const String &caption);
  90. ~ButtonProp();
  91. void setPropWidth(Number width);
  92. UIButton *getButton();
  93. private:
  94. UIButton *button;
  95. };
  96. class NumberProp : public PropProp {
  97. public:
  98. NumberProp(String caption);
  99. ~NumberProp();
  100. void handleEvent(Event *event);
  101. void set(Number number);
  102. Number get();
  103. void setPropWidth(Number width);
  104. void setPropData(PolycodeEditorPropActionData* data);
  105. UITextInput *numberEntry;
  106. Number lastValue;
  107. Number currentValue;
  108. };
  109. class TargetBindingProp : public PropProp {
  110. public:
  111. TargetBindingProp(Shader *shader, Material *material, ShaderBinding *binding, RenderTargetBinding *targetBinding);
  112. ~TargetBindingProp();
  113. void handleEvent(Event *event);
  114. void setPropWidth(Number width);
  115. RenderTargetBinding *targetBinding;
  116. Material *material;
  117. Shader *shader;
  118. ShaderBinding *binding;
  119. UIComboBox *typeComboBox;
  120. UIComboBox *targetComboBox;
  121. UIComboBox *textureComboBox;
  122. UIImageButton *removeButton;
  123. };
  124. class RenderTargetProp : public PropProp {
  125. public:
  126. RenderTargetProp(ShaderRenderTarget *renderTarget, Material *material);
  127. ~RenderTargetProp();
  128. void handleEvent(Event *event);
  129. void setPropWidth(Number width);
  130. void recreateRenderTarget();
  131. Material *material;
  132. ShaderRenderTarget *renderTarget;
  133. UITextInput *nameInput;
  134. UIComboBox *typeComboBox;
  135. UITextInput *widthInput;
  136. UITextInput *heightInput;
  137. UIImageButton *removeButton;
  138. };
  139. class ShaderPassProp : public PropProp {
  140. public:
  141. ShaderPassProp(Material *material, int shaderIndex);
  142. ~ShaderPassProp();
  143. void handleEvent(Event *event);
  144. void setPropWidth(Number width);
  145. Material *material;
  146. Shader *shader;
  147. int shaderIndex;
  148. UIComboBox *shaderComboBox;
  149. UIImageButton *removeButton;
  150. UIButton *editButton;
  151. };
  152. class RemovableStringProp : public PropProp {
  153. public:
  154. RemovableStringProp(const String &caption);
  155. ~RemovableStringProp();
  156. void handleEvent(Event *event);
  157. String getCaption();
  158. UILabel *label;
  159. UIImageButton *removeButton;
  160. };
  161. class CustomProp : public PropProp {
  162. public:
  163. CustomProp(String key, String value);
  164. ~CustomProp();
  165. void handleEvent(Event *event);
  166. void set(String key, String val);
  167. String getValue();
  168. String getKey();
  169. UITextInput *keyEntry;
  170. UITextInput *valueEntry;
  171. UIImageButton *removeButton;
  172. };
  173. class StringProp : public PropProp {
  174. public:
  175. StringProp(String caption);
  176. ~StringProp();
  177. void handleEvent(Event *event);
  178. void set(String str);
  179. String get();
  180. void setPropWidth(Number width);
  181. void setPropData(PolycodeEditorPropActionData* data);
  182. UITextInput *stringEntry;
  183. String lastValue;
  184. String currentValue;
  185. };
  186. class ColorProp : public PropProp {
  187. public:
  188. ColorProp(String caption);
  189. ~ColorProp();
  190. void handleEvent(Event *event);
  191. virtual void setPropData(PolycodeEditorPropActionData* data);
  192. void set(Color color);
  193. Color get();
  194. Color currentColor;
  195. Color lastColor;
  196. UIColorBox *colorEntry;
  197. };
  198. class ComboProp : public PropProp {
  199. public:
  200. ComboProp(String caption);
  201. ~ComboProp();
  202. void handleEvent(Event *event);
  203. void setPropData(PolycodeEditorPropActionData* data);
  204. void setPropWidth(Number width);
  205. void set(unsigned int index);
  206. unsigned int get();
  207. UIComboBox *comboEntry;
  208. int lastValue;
  209. int currentValue;
  210. };
  211. class BoolProp : public PropProp {
  212. public:
  213. BoolProp(String caption);
  214. ~BoolProp();
  215. void handleEvent(Event *event);
  216. void setPropData(PolycodeEditorPropActionData* data);
  217. void set(bool val);
  218. bool get();
  219. UICheckBox *checkEntry;
  220. bool lastData;
  221. bool currentData;
  222. };
  223. class SoundProp : public PropProp {
  224. public:
  225. SoundProp(String caption);
  226. ~SoundProp();
  227. void handleEvent(Event *event);
  228. void set(String soundPath);
  229. String get();
  230. void setPropData(PolycodeEditorPropActionData* data);
  231. Sound *previewSound;
  232. UILabel *soundFile;
  233. UIButton *changeButton;
  234. UIButton *playButton;
  235. String lastData;
  236. String currentData;
  237. };
  238. class BezierRGBACurveProp : public PropProp {
  239. public:
  240. BezierRGBACurveProp(String caption);
  241. ~BezierRGBACurveProp();
  242. void handleEvent(Event *event);
  243. BezierCurve *curveR;
  244. BezierCurve *curveG;
  245. BezierCurve *curveB;
  246. BezierCurve *curveA;
  247. UIButton *changeButton;
  248. };
  249. class BezierCurveProp : public PropProp {
  250. public:
  251. BezierCurveProp(String caption, String curveName);
  252. ~BezierCurveProp();
  253. void handleEvent(Event *event);
  254. String curveName;
  255. BezierCurve *curve;
  256. UIButton *changeButton;
  257. };
  258. class MaterialProp : public PropProp {
  259. public:
  260. MaterialProp(const String &caption);
  261. ~MaterialProp();
  262. void setEntityInstance(SceneEntityInstance *instance);
  263. void set(Material *material);
  264. Material *get();
  265. void setPropWidth(Number width);
  266. void handleEvent(Event *event);
  267. private:
  268. SceneEntityInstance *entityInstance;
  269. UIRect *previewShape;
  270. UIButton *changeButton;
  271. UILabel *materialLabel;
  272. Material *currentMaterial;
  273. };
  274. class TextureProp : public PropProp {
  275. public:
  276. TextureProp(String caption);
  277. ~TextureProp();
  278. void handleEvent(Event *event);
  279. void setPropWidth(Number width);
  280. void set(Texture *texture);
  281. Texture* get();
  282. void setPropData(PolycodeEditorPropActionData* data);
  283. UIRect *previewShape;
  284. UIButton *changeButton;
  285. UILabel *textureLabel;
  286. String lastData;
  287. String currentData;
  288. };
  289. class SceneSpriteProp : public PropProp {
  290. public:
  291. SceneSpriteProp(String caption);
  292. ~SceneSpriteProp();
  293. void handleEvent(Event *event);
  294. void setPropData(PolycodeEditorPropActionData* data);
  295. void set(String fileName);
  296. String get();
  297. SceneSprite *previewSprite;
  298. UIButton *changeButton;
  299. String lastData;
  300. String currentData;
  301. };
  302. class SceneEntityInstanceProp : public PropProp {
  303. public:
  304. SceneEntityInstanceProp(String caption);
  305. ~SceneEntityInstanceProp();
  306. void handleEvent(Event *event);
  307. void setPropData(PolycodeEditorPropActionData* data);
  308. void set(String fileName);
  309. String get();
  310. SceneEntityInstance *previewInstance;
  311. UIButton *changeButton;
  312. String lastData;
  313. String currentData;
  314. };
  315. class PropSheet : public UIElement {
  316. public:
  317. PropSheet(String caption, String type);
  318. ~PropSheet();
  319. void Resize(Number width, Number height);
  320. virtual void applyPropActionData(PolycodeEditorPropActionData *data);
  321. void handleEvent(Event *event);
  322. void layoutProps();
  323. void setCollapsed(bool val);
  324. void addProp(PropProp *prop);
  325. void setTopPadding(Number padding);
  326. String caption;
  327. String type;
  328. Number propHeight;
  329. Entity *contents;
  330. UIRect *bg;
  331. UIImageButton *collapseButton;
  332. UIImageButton *expandButton;
  333. bool collapsed;
  334. Number propTopPadding;
  335. bool customUndoHandler;
  336. std::vector<PropProp*> props;
  337. };
  338. class ShaderOptionsSheet : public PropSheet {
  339. public:
  340. ShaderOptionsSheet();
  341. ~ShaderOptionsSheet();
  342. void handleEvent(Event *event);
  343. void Update();
  344. void clearShader();
  345. void setOptionsFromParams(std::vector<ProgramParam> &params);
  346. void setShader(Shader *shader, Material *material, ShaderBinding *binding);
  347. private:
  348. Shader *shader;
  349. Material *material;
  350. ShaderBinding *binding;
  351. };
  352. class ShaderTexturesSheet : public PropSheet {
  353. public:
  354. ShaderTexturesSheet();
  355. ~ShaderTexturesSheet();
  356. void handleEvent(Event *event);
  357. void Update();
  358. void clearShader();
  359. void setShader(Shader *shader, Material *material, ShaderBinding *binding);
  360. private:
  361. Shader *shader;
  362. Material *material;
  363. ShaderBinding *binding;
  364. std::vector<TextureProp*> textureProps;
  365. std::vector<ComboProp*> cubemapProps;
  366. };
  367. class EntitySheet : public PropSheet {
  368. public:
  369. EntitySheet();
  370. ~EntitySheet();
  371. void handleEvent(Event *event);
  372. void setEntity(Entity *entity);
  373. protected:
  374. Entity *entity;
  375. StringProp *idProp;
  376. StringProp *tagProp;
  377. ColorProp *colorProp;
  378. ComboProp *blendingProp;
  379. };
  380. class ShaderPassesSheet : public PropSheet {
  381. public:
  382. ShaderPassesSheet(ResourcePool *resourcePool);
  383. ~ShaderPassesSheet();
  384. void handleEvent(Event *event);
  385. void refreshPasses();
  386. void Update();
  387. void setMaterial(Material *material);
  388. ShaderBinding *binding;
  389. Material *material;
  390. ShaderPassProp *selectedProp;
  391. ResourcePool *resourcePool;
  392. UIButton *addButton;
  393. int removeIndex;
  394. };
  395. class TargetBindingsSheet : public PropSheet {
  396. public:
  397. TargetBindingsSheet();
  398. ~TargetBindingsSheet();
  399. void handleEvent(Event *event);
  400. void setShader(Shader *shader, Material *material, ShaderBinding *binding);
  401. void Update();
  402. void refreshTargets();
  403. ShaderBinding *binding;
  404. Material *material;
  405. Shader *shader;
  406. int shaderIndex;
  407. UIButton *addButton;
  408. RenderTargetBinding *bindingToRemove;
  409. };
  410. class RenderTargetsSheet : public PropSheet {
  411. public:
  412. RenderTargetsSheet();
  413. ~RenderTargetsSheet();
  414. void Update();
  415. void handleEvent(Event *event);
  416. void refreshTargets();
  417. ShaderBinding *binding;
  418. Material *material;
  419. Material *lastMaterial;
  420. Number normTextureWidth;
  421. Number normTextureHeight;
  422. UIButton *addButton;
  423. int removeIndex;
  424. };
  425. class TransformSheet : public PropSheet {
  426. public:
  427. TransformSheet();
  428. ~TransformSheet();
  429. void Update();
  430. void setEntity(Entity *entity);
  431. void handleEvent(Event *event);
  432. protected:
  433. Entity *entity;
  434. Vector3Prop *positionProp;
  435. Vector3Prop *scaleProp;
  436. Vector3Prop *rotationProp;
  437. Vector3 lastPosition;
  438. Vector3 lastScale;
  439. Vector3 lastRotation;
  440. };
  441. class ParticleEmitterSheet : public PropSheet {
  442. public:
  443. ParticleEmitterSheet();
  444. ~ParticleEmitterSheet();
  445. void handleEvent(Event *event);
  446. void setParticleEmitter(SceneParticleEmitter *emitter);
  447. protected:
  448. SceneParticleEmitter *emitter;
  449. ComboProp *typeProp;
  450. NumberProp *countProp;
  451. NumberProp *lifetimeProp;
  452. NumberProp *particleSizeProp;
  453. BoolProp *worldParticlesProp;
  454. BoolProp *loopingProp;
  455. Vector3Prop *particleRotaionProp;
  456. Vector3Prop *gravityProp;
  457. Vector3Prop *directionProp;
  458. Vector3Prop *sizeProp;
  459. Vector3Prop *deviationProp;
  460. BoolProp *perlinProp;
  461. Vector3Prop *perlinSizeProp;
  462. BoolProp *useColorCurvesProp;
  463. BezierRGBACurveProp *colorCurveProp;
  464. BoolProp *useScaleCurvesProp;
  465. BezierCurveProp *scaleCurveProp;
  466. };
  467. class SceneLightSheet : public PropSheet {
  468. public:
  469. SceneLightSheet();
  470. ~SceneLightSheet();
  471. void updateOptionVisibility();
  472. void setSceneLight(SceneLight *light);
  473. void handleEvent(Event *event);
  474. protected:
  475. SceneLight *light;
  476. ComboProp *typeProp;
  477. ColorProp *lightColorProp;
  478. ColorProp *specularColorProp;
  479. NumberProp *intensityProp;
  480. SliderProp *constantAttenuationProp;
  481. SliderProp *linearAttenuationProp;
  482. SliderProp *quadraticAttenuationProp;
  483. SliderProp *spotlightCutoffProp;
  484. SliderProp *spotlightExponentProp;
  485. BoolProp *castShadowsProp;
  486. SliderProp *shadowMapFOVProp;
  487. NumberProp *shadowResolutionProp;
  488. };
  489. /*
  490. class SceneMeshSheet : public PropSheet {
  491. public:
  492. SceneMeshSheet();
  493. ~SceneMeshSheet();
  494. void setSceneMesh(SceneMesh *mesh);
  495. void handleEvent(Event *event);
  496. private:
  497. SceneMesh *sceneMesh;
  498. };
  499. */
  500. class ScenePrimitiveSheet : public PropSheet {
  501. public:
  502. ScenePrimitiveSheet();
  503. ~ScenePrimitiveSheet();
  504. void setScenePrimitive(ScenePrimitive *primitive);
  505. void handleEvent(Event *event);
  506. protected:
  507. void updatePrimitiveLabels();
  508. ScenePrimitive *primitive;
  509. ComboProp *typeProp;
  510. NumberProp *option1Prop;
  511. NumberProp *option2Prop;
  512. NumberProp *option3Prop;
  513. NumberProp *option4Prop;
  514. NumberProp *option5Prop;
  515. };
  516. class MaterialPropSheet : public PropSheet {
  517. public:
  518. MaterialPropSheet();
  519. ~MaterialPropSheet();
  520. void setEntityInstance(SceneEntityInstance *instance);
  521. void handleEvent(Event *event);
  522. void setSceneMesh(SceneMesh *sceneMesh);
  523. protected:
  524. MaterialProp *materialProp;
  525. SceneMesh *sceneMesh;
  526. };
  527. class EntityPropSheet : public PropSheet {
  528. public:
  529. EntityPropSheet();
  530. void handleEvent(Event *event);
  531. void Update();
  532. void refreshProps();
  533. void applyPropActionData(PolycodeEditorPropActionData *data);
  534. UIButton *addButton;
  535. Entity *entity;
  536. Entity *lastEntity;
  537. int lastNumProps;
  538. int removeIndex;
  539. };
  540. class SceneLabelSheet : public PropSheet {
  541. public:
  542. SceneLabelSheet();
  543. ~SceneLabelSheet();
  544. void refreshFonts();
  545. void handleEvent(Event *event);
  546. void setSceneLabel(SceneLabel *label);
  547. private:
  548. SceneLabel *label;
  549. StringProp *caption;
  550. NumberProp *size;
  551. NumberProp *actualHeight;
  552. ComboProp *font;
  553. BoolProp *enableAA;
  554. };
  555. class SceneSpriteSheet : public PropSheet {
  556. public:
  557. SceneSpriteSheet();
  558. ~SceneSpriteSheet();
  559. void handleEvent(Event *event);
  560. void setSprite(SceneSprite *sprite);
  561. SceneSprite *sprite;
  562. SceneSpriteProp *spriteProp;
  563. ComboProp *defaultAnimationProp;
  564. NumberProp *spriteWidthProp;
  565. NumberProp *spriteHeightProp;
  566. };
  567. class CameraSheet : public PropSheet {
  568. public:
  569. CameraSheet();
  570. ~CameraSheet();
  571. void handleEvent(Event *event);
  572. void setCamera(Camera *camera);
  573. void updateOptionVisibility();
  574. NumberProp *exposureProp;
  575. BoolProp *orthoProp;
  576. NumberProp *fovProp;
  577. ComboProp *orthoSizeTypeProp;
  578. NumberProp *orthoWidthProp;
  579. NumberProp *orthoHeightProp;
  580. NumberProp *nearClipPlane;
  581. NumberProp *farClipPlane;
  582. Camera *camera;
  583. };
  584. class SceneEntityInstanceSheet : public PropSheet {
  585. public:
  586. SceneEntityInstanceSheet();
  587. ~SceneEntityInstanceSheet();
  588. void handleEvent(Event *event);
  589. void Update();
  590. SceneEntityInstance *instance;
  591. SceneEntityInstanceProp *instanceProp;
  592. };
  593. class SoundSheet : public PropSheet {
  594. public:
  595. SoundSheet();
  596. ~SoundSheet();
  597. void handleEvent(Event *event);
  598. void setSound(SceneSound *sound);
  599. SceneSound *sound;
  600. SoundProp *soundProp;
  601. NumberProp *referenceDistance;
  602. NumberProp *maxDistance;
  603. SliderProp *volume;
  604. SliderProp *pitch;
  605. };
  606. class LinkedMaterialsSheet : public PropSheet {
  607. public:
  608. LinkedMaterialsSheet();
  609. ~LinkedMaterialsSheet();
  610. void handleEvent(Event *event);
  611. void setEntityInstance(SceneEntityInstance *instance);
  612. void Update();
  613. void updateMaterials();
  614. private:
  615. SceneEntityInstance *instance;
  616. ButtonProp *addMaterialProp;
  617. int poolRemoveIndex;
  618. };
  619. class PropList : public UIElement {
  620. public:
  621. PropList(String caption="PROPERTIES");
  622. ~PropList();
  623. void updateProps();
  624. void updateSize();
  625. void addPropSheet(PropSheet *sheet);
  626. void handleEvent(Event *event);
  627. void Resize(Number width, Number height);
  628. UIScrollContainer *scrollContainer;
  629. protected:
  630. Entity *propContents;
  631. std::vector<PropSheet*> props;
  632. UIRect *bg;
  633. UIRect *bg2;
  634. };
  635. class PolycodeEditorPropActionData : public PolycodeEditorActionData {
  636. public:
  637. PolycodeEditorPropActionData(){ entity = NULL; }
  638. virtual ~PolycodeEditorPropActionData(){
  639. delete entity;
  640. }
  641. bool boolVal;
  642. String stringVal;
  643. int intVal;
  644. Number numVal;
  645. Color colorVal;
  646. Vector3 vector3Val;
  647. Vector2 vector2Val;
  648. Entity *entity;
  649. PropSheet *sheet;
  650. PropProp *prop;
  651. };
  652. PolycodeEditorPropActionData *PropDataBool(bool val);
  653. PolycodeEditorPropActionData *PropDataInt(int val);
  654. PolycodeEditorPropActionData *PropDataNumber(Number val);
  655. PolycodeEditorPropActionData *PropDataString(String val);
  656. PolycodeEditorPropActionData *PropDataColor(Color val);
  657. PolycodeEditorPropActionData *PropDataVector3(Vector3 val);
  658. PolycodeEditorPropActionData *PropDataVector2(Vector2 val);
  659. PolycodeEditorPropActionData *PropDataEntity(Entity *entity);
  660. class PropEvent : public Event {
  661. public:
  662. PropEvent(PropProp *prop, PropSheet *sheet, PolycodeEditorPropActionData *beforeData, PolycodeEditorPropActionData *afterData);
  663. virtual ~PropEvent();
  664. void setSheet(PropSheet *sheet);
  665. PropProp *prop;
  666. PropSheet *sheet;
  667. PolycodeEditorPropActionData *beforeData;
  668. PolycodeEditorPropActionData *afterData;
  669. static const int EVENTBASE_PROPEVENT = 0xC00;
  670. static const int EVENT_PROP_CHANGE = EVENTBASE_PROPEVENT+0;
  671. };