@ObjView.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. /******************************************************************************/
  2. /******************************************************************************
  3. Meshes are stored in:
  4. "Edit" (untransformed, skeleton not set but has BoneMap, parts not merged , only MeshBase available)
  5. "Game" ( transformed, skeleton set with BoneMap, parts merged by material and DrawGroup, only MeshRender available)
  6. Upon opening a mesh in Object Editor, "Edit" version is loaded (and MeshRender created)
  7. every usage of the mesh must be combined with transforming by its current "Game" matrix.
  8. Upon saving a mesh, it's saved as both "Edit" and "Game" versions.
  9. /******************************************************************************/
  10. class ObjView : Viewport4Region
  11. {
  12. enum MODE
  13. {
  14. TRANSFORM ,
  15. PARAM ,
  16. LOD ,
  17. MESH ,
  18. VARIATIONS,
  19. SLOTS ,
  20. BONES ,
  21. SKIN ,
  22. PHYS ,
  23. GROUP ,
  24. REMOVE ,
  25. RAGDOLL ,
  26. BODY ,
  27. BACKGROUND,
  28. };
  29. static cchar8 *mode_t[]
  30. ;
  31. enum TRANS_OP
  32. {
  33. TRANS_MOVE,
  34. TRANS_ROT,
  35. TRANS_SCALE,
  36. };
  37. enum SKIN_MODE
  38. {
  39. SKIN_SEL_MESH_PART,
  40. SKIN_SEL_BONE,
  41. SKIN_CHANGE_SKIN,
  42. };
  43. static cchar8 *skin_mode_t[]
  44. ;
  45. static cchar8 *skin_mode_desc[]
  46. ;
  47. class BackMesh
  48. {
  49. MeshPtr mesh;
  50. Matrix matrix;
  51. void draw();
  52. void drawBlend();
  53. public:
  54. BackMesh();
  55. };
  56. class SlotMesh
  57. {
  58. MeshPtr mesh;
  59. Str8 name;
  60. flt scale;
  61. void set(C MeshPtr &mesh, C Str &name);
  62. void draw(Skeleton &skel);
  63. public:
  64. SlotMesh();
  65. };
  66. class Info : GuiCustom
  67. {
  68. virtual void draw(C GuiPC &gpc)override;
  69. };
  70. class MeshChange : Edit::_Undo::Change
  71. {
  72. class NameWeight
  73. {
  74. Str name;
  75. flt weight;
  76. };
  77. class BoneWeight : Mems<NameWeight>
  78. {
  79. Str8 name;
  80. };
  81. bool sel_only,
  82. can_use_cur_skel_to_saved_skel; // this needs to be disabled if we've flushed skeleton ('saved_skel' was changed)
  83. Mesh data;
  84. ElmMesh mesh_data;
  85. EditSkeleton edit_skel, cur_skel_to_saved_skel;
  86. Skeleton skel;
  87. Matrix mesh_matrix;
  88. Memc<VecI2> sel_vtx, sel_face;
  89. Mems<Rename> bone_renames; // renames applied in this change only
  90. Mems<Str > bone_removals; // removals applied in this change only
  91. Mems<BoneWeight> bone_restores;
  92. void removeBone(C Str &name);
  93. void selOnly();
  94. virtual uint memUsage()C override;
  95. virtual void create(ptr user)override;
  96. void apply(bool undo);
  97. virtual void apply(ptr user)override;
  98. public:
  99. MeshChange();
  100. };
  101. class PhysChange : Edit::_Undo::Change
  102. {
  103. ElmPhys phys_data;
  104. PhysBody data;
  105. virtual void create(ptr user)override;
  106. virtual void apply(ptr user)override;
  107. };
  108. class SkinBrush : BrushClass
  109. {
  110. SkinBrush& create(GuiObj &parent, C Vec2 &rd);
  111. virtual bool hasMsWheelFocus()C override;
  112. };
  113. class BoneRoot
  114. {
  115. Str display;
  116. EditSkeleton::NodePtr node;
  117. };
  118. Mesh mesh; // in original matrix as it was imported
  119. MeshPtr mesh_ptr, // used to hold reference to game mesh (this is needed if we're editing 'mesh' on a temp var, and 'skel' on cache var, this way we can keep 'mesh' cache var in the same state as temp var)
  120. body ; // used to hold reference to body game mesh
  121. Box mesh_box; // mesh box after transformation
  122. Matrix mesh_matrix; // mesh transformation matrix
  123. Matrix phys_part_matrix; // used for axis drawing
  124. PhysBodyPtr phys; // phys body (in 'mesh_matrix')
  125. Skeleton *mesh_skel, mesh_skel_temp, // skeleton of the mesh (in 'mesh_matrix'), if exists points to 'mesh_skel_temp' (otherwise null), it is important to operate on a temporary skeleton, so that modifying skeleton will not affect the existing animations, until it's flushed
  126. *body_skel, // skeleton of the body mesh
  127. saved_skel; // 'mesh_skel' as it is on the disk without any modifications
  128. Matrix saved_skel_matrix; // matrix of 'saved_skel'
  129. EditSkeleton saved_edit_skel,
  130. edit_skel, // always in original matrix as it was imported
  131. cur_skel_to_saved_skel; // this will store mapping from current skeleton to saved skeleton, 'nodes'=saved_skel, 'bones'=mesh_skel
  132. Particles particles;
  133. UID obj_id;
  134. Elm *obj_elm, *mesh_elm, *skel_elm, *phys_elm;
  135. bool has_cur_pos;
  136. Vec cur_pos, axis_vec;
  137. int lit_lod, sel_lod, sel_variation, lit_part, lit_vf_part, lit_vtx, lit_face, trans_axis, // 'lit_vf_part'=part of the ('lit_vtx' or 'lit_face'), 'lit_face' can contain SIGN_BIT for quads
  138. lit_bone, lit_bone_vis, lit_slot, sel_bone, sel_bone_vis, sel_slot, slot_axis, bone_axis, // 'vis' operate on the temporary 'getVisSkel'
  139. lit_phys, sel_phys, phys_axis;
  140. Memc<VecI2> sel_vtx, sel_face; // binary sorted, x=part, y=element, 'sel_face.y' can contain SIGN_BIT for quads
  141. Str8 sel_bone_name, sel_slot_name;
  142. int vtx_dup_mode;
  143. flt vtx_sel_r, edit_time;
  144. Tabs mode;
  145. Button axis, box, show_cur_pos, vtxs, vtxs_front, vtxs_normals, light_dir;
  146. Tabs slot_tabs, bone_tabs, phys_tabs, ragdoll_tabs, trans_tabs;
  147. Memc<SlotMesh> slot_meshes;
  148. Memc<BackMesh> back_meshes;
  149. TransformRegion trans, trans_mesh;
  150. LeafRegion leaf;
  151. LodRegion lod;
  152. GroupRegion group;
  153. Info info;
  154. ParamEditor param_edit;
  155. bool changed_obj, changed_mesh, changed_skel, changed_phys;
  156. TimeStamp mesh_file_time, skel_file_time;
  157. Button mesh_undo, mesh_redo, locate, phys_undo, phys_redo, phys_box, phys_ball, phys_capsule, phys_tube, phys_convex[5], phys_mesh, phys_del, goto_phys_mtrl, goto_body, goto_group, clear_background;
  158. Memx<Property> phys_props, body_props, group_props;
  159. Tabs vtx_face_sel_mode, lod_tabs, variation_tabs, skin_tabs, bone_move_tabs;
  160. Text vtx_face_sel_text, background_alpha_t, bone_root_t;
  161. Slider background_alpha;
  162. ComboBox mesh_ops, skin_ops, slot_ops, bone_ops, phys_ops, bone_root, bone_children, bone_children_rot;
  163. Memc<BoneRoot> bone_root_data;
  164. TextWhite ts;
  165. MeshParts mesh_parts;
  166. MeshVariations mesh_variations;
  167. AdjustBoneOrns adjust_bone_orns;
  168. SkinBrush skin_brush;
  169. Menu menu;
  170. Memc<UID> menu_ids;
  171. Edit::Undo<MeshChange> mesh_undos; bool mesh_undos_undo;
  172. Edit::Undo<PhysChange> phys_undos; void undoVis();
  173. // get
  174. bool selected()C;
  175. bool lodEditDist ()C;
  176. bool lodDrawAtDist()C;
  177. bool customDrawMatrix()C;
  178. bool partVisible(int p, C MeshPart &part, bool allow_lit=true)C;
  179. bool partOp (int p)C;
  180. bool partSel(int p)C;
  181. bool frontFace(C Vec &pos, C Vec *nrm, C Matrix &cam)C;
  182. bool editMeshParts()C;
  183. bool transMesh ()C;
  184. bool showBoxes ()C;
  185. bool showMainBox ()C;
  186. Matrix transformMatrix()C;
  187. Matrix transformMatrix(bool sel)C;
  188. Circle vtxSelCircle()C;
  189. bool showVtxSelCircle();
  190. bool showChangeSkin ()C;
  191. bool showChangeSkinShape();
  192. Shape changeSkinShape()C;
  193. int boneTabs()C;
  194. int boneAxis()C;
  195. flt posScale()C;
  196. flt vtxDupPosEps()C;
  197. Vec selMeshCenter()C;
  198. Skeleton* getVisSkel();
  199. void setMatrixAtDist(Matrix &matrix, flt dist);
  200. static void Render();
  201. void render();
  202. static void Draw(Viewport &viewport);
  203. void draw(Edit::Viewport4::View&view);
  204. static void LodChanged(ObjView &editor);
  205. static void VariationChanged(ObjView &editor);
  206. static void ModeChanged(ObjView &editor);
  207. static void Mode1 (ObjView &editor);
  208. static void Mode2 (ObjView &editor);
  209. static void Mode3 (ObjView &editor);
  210. static void Mode4 (ObjView &editor);
  211. static void Mode5 (ObjView &editor);
  212. static void Mode6 (ObjView &editor);
  213. static void Mode7 (ObjView &editor);
  214. static void Mode8 (ObjView &editor);
  215. static void Mode9 (ObjView &editor);
  216. static void Mode0 (ObjView &editor);
  217. static void ModeS0 (ObjView &editor);
  218. static void ModeS1 (ObjView &editor);
  219. static void ModeS2 (ObjView &editor);
  220. static void ModeS3 (ObjView &editor);
  221. static void ModeS4 (ObjView &editor);
  222. static void ModeS5 (ObjView &editor);
  223. static void ModeS6 (ObjView &editor);
  224. static void ModeS7 (ObjView &editor);
  225. static void ModeS8 (ObjView &editor);
  226. static void ModeS9 (ObjView &editor);
  227. static void ModeS10 (ObjView &editor);
  228. static void ModeS11 (ObjView &editor);
  229. static void Identity (ObjView &editor);
  230. static void LightMode (ObjView &editor);
  231. static void PrevObj (ObjView &editor);
  232. static void NextObj (ObjView &editor);
  233. static void ShowBox (ObjView &editor);
  234. static void ShowCur (ObjView &editor);
  235. static void VtxsChanged (ObjView &editor);
  236. static void MeshDelete (ObjView &editor); void meshDelete ();
  237. static void MeshSplit (ObjView &editor); void meshSplit ();
  238. static void MeshAlignXZ (ObjView &editor); void meshAlign(bool xz);
  239. static void MeshAlign (ObjView &editor);
  240. static void MeshWeldPos (ObjView &editor); void meshWeldPos (); void meshWeldPos(flt pos_eps);
  241. static void MeshSetPos (ObjView &editor); void meshSetPos ();
  242. static void MeshReverse (ObjView &editor); void meshReverse ();
  243. static void MeshReverseN (ObjView &editor); void meshReverseN ();
  244. static void MeshSetNormalN (ObjView &editor); void meshSetNrm(uint vtx_test);
  245. static void MeshSetNormalT (ObjView &editor);
  246. static void MeshSetNormalP (ObjView &editor);
  247. static void MeshSetNormal (ObjView &editor);
  248. static void MeshSetNormalH (ObjView &editor); void meshSetNrmH();
  249. static void MeshNormalY (ObjView &editor); void meshNrmY ();
  250. static void MeshSetVtxAO (ObjView &editor);
  251. static void MeshCreateFace (ObjView &editor); void meshCreateFace();
  252. static void MeshMergeFaces (ObjView &editor); void meshMergeFaces();
  253. static void MeshRotQuads (ObjView &editor); void meshRotQuads ();
  254. static void MeshQuadToTri (ObjView &editor); void meshQuadToTri ();
  255. static void MeshTesselate (ObjView &editor); void meshTesselate ();
  256. static void MeshSubdivide (ObjView &editor); void meshSubdivide ();
  257. static void MeshColorBrght (ObjView &editor); void meshColorBrght();
  258. static void MeshDelDblSide (ObjView &editor); void meshDelDblSide();
  259. static void MeshSeparate1 (ObjView &editor); void meshSeparate1 ();
  260. static void MeshSeparateN (ObjView &editor); void meshSeparateN ();
  261. static void MeshCopyParts (ObjView &editor); void meshCopyParts ();
  262. static void SetBody (ObjView &editor);
  263. static void AnimTargetObj (ObjView &editor);
  264. static void MeshSkinFull (ObjView &editor); void meshSkinFull ();
  265. static void MeshSkinFullP (ObjView &editor); void meshSkinFullP ();
  266. static void MeshSkinFullU (ObjView &editor); void meshSkinFullU ();
  267. static void MeshSkinAuto (ObjView &editor); void meshSkinAuto ();
  268. static void MeshEditSel (ObjView &editor);
  269. static void MeshVFS0 (ObjView &editor);
  270. static void MeshVFS1 (ObjView &editor);
  271. static void MeshVFS2 (ObjView &editor);
  272. static void MeshVFS3 (ObjView &editor);
  273. static void ShowVtxs (ObjView &editor);
  274. static void ShowVtxsF (ObjView &editor);
  275. static void ShowVtxsN (ObjView &editor);
  276. static void GotoPhMtrl (ObjView &editor);
  277. static void ClearPhMtrl (ObjView &editor);
  278. static void GotoBody (ObjView &editor);
  279. static void ClearBody (ObjView &editor);
  280. static void GotoGroups (ObjView &editor);
  281. static void ClearGroups (ObjView &editor);
  282. static void ClearBack (ObjView &editor);
  283. static void MeshRemVtxTex1 (ObjView &editor);
  284. static void MeshRemVtxTex2 (ObjView &editor);
  285. static void MeshRemVtxTex12(ObjView &editor);
  286. static void MeshRemVtxColor(ObjView &editor);
  287. static void MeshRemVtxSkin (ObjView &editor);
  288. void modeS(int i);
  289. void remVtx(uint flag, C MaterialPtr &mtrl=null, bool only_selected=false);
  290. static void MeshUndo(ObjView &editor);
  291. static void MeshRedo(ObjView &editor);
  292. static void Locate(ObjView &editor);
  293. // get
  294. flt absLodDist(C MeshLod&lod );
  295. flt lodDist(C MeshLod&lod );
  296. void lodDist( MeshLod&lod, flt dist);
  297. void setLodDist( MeshLod&lod, flt dist);
  298. C MeshLod& getLod()C;
  299. MeshLod& getLod();
  300. C MeshLod& getDrawLod()C;
  301. MeshLod& getDrawLod();
  302. C MeshPart* getPart(int i)C;
  303. MeshPart* getPart(int i);
  304. int getPart(GuiObj *go, C Vec2 &screen_pos, Vec *hit_pos=null);
  305. int getVtxFace(GuiObj *go, C Vec2 &screen_pos, int *hit_vtx=null, int *hit_face=null, Vec *hit_pos=null);
  306. void getVtxs(GuiObj *go, C Shape &shape, MemPtr<VecI2> vtxs); // 'vtxs' will be sorted
  307. void getSkel(GuiObj *go, C Vec2 &screen_pos, int *bone_i, int *slot_i);
  308. void getSkelSlot(C Vec2 &screen_pos);
  309. int getPhys(GuiObj *go, C Vec2 &screen_pos);
  310. MeshPart* validateDup(int part);
  311. void getVtxNeighbors(MemPtr<int> vtxs, int vtx, int part);
  312. void getFaceNeighbors(MemPtr<int> faces, int face, int part);
  313. void getSelectedVtxs(MemPtr<VecI2> vtxs, bool from_vtxs=true, bool from_faces=true);
  314. // set
  315. void getSamePos(int part, int vtx, MemPtr<VecI2> vtxs);
  316. void includeSamePos(int part, MemPtr<VecI2> vtxs); // !! assumes that 'vtxs' is sorted and valid (point to valid indexes) !!
  317. void selVFClear();
  318. void litSelVFClear();
  319. void selVFSet(int part, int vtx, int face, bool same_pos=true);
  320. void selVFToggle(int part, int vtx, int face, bool same_pos=true);
  321. void selVFInclude(int part, int vtx, int face, bool same_pos=true);
  322. void selVFExclude(int part, int vtx, int face, bool same_pos=true);
  323. void selVFDo();
  324. void selVFDo(bool include, bool same_pos=true);
  325. void selUndo();
  326. // create
  327. void setMenu();
  328. void setMenu(Node<MenuElm> &menu, C Str &prefix);
  329. ObjView& create();
  330. void createMesh();
  331. virtual void resize()override;
  332. void setShader();
  333. // operations
  334. void flushObj();
  335. void flushMeshSkel(SAVE_MODE save_mode=SAVE_DEFAULT);
  336. void flushPhys();
  337. void flush(SAVE_MODE save_mode=SAVE_DEFAULT);
  338. void setChangedObj ( );
  339. void setChangedMesh(bool file, bool box=true);
  340. void setChangedSkel(bool bone );
  341. void setChangedPhys( );
  342. void setBox ( );
  343. void gotoPhysMtrl();
  344. void gotoBody();
  345. void gotoDrawGroupEnum();
  346. void setPhysMtrl(C UID &mtrl_id);
  347. void setBody(C UID &body_id);
  348. void setDrawGroupEnum(C UID &enum_id);
  349. void animTargetObj();
  350. void resetTransform();
  351. void setTransform(C Matrix &matrix);
  352. void applyTransform(C Matrix &matrix);
  353. void skinChanged();
  354. void selectedChanged();
  355. bool selectionZoom(flt &dist);
  356. virtual void camCenter(bool zoom)override;
  357. void reloadObj();
  358. void syncObj();
  359. void reloadMeshSkel();
  360. void reloadPhys();
  361. void reload();
  362. Str nodeDisplayName(int node_i)C;
  363. void addBoneRootData(int parent, int max_depth);
  364. void setBoneRootTextSize();
  365. void toGuiSkel();
  366. void toGuiPhys();
  367. void toGui();
  368. void set(Elm *elm);
  369. void activate(Elm *elm);
  370. void toggle(Elm *elm);
  371. void resetDrawGroupEnum();
  372. void enumChanged(C UID &enum_id);
  373. void meshVariationChanged();
  374. void elmChanged(C UID &elm_id);
  375. void meshChanged();
  376. void skelTransformChanged();
  377. void erasing(C UID &elm_id);
  378. Elm* getMeshElm();
  379. Elm* getSkelElm();
  380. void dragPhysMtrl(Memc<UID> &elms);
  381. void dragDrawGroup(Memc<UID> &elms);
  382. void dragBody(Memc<UID> &elms);
  383. void setAutoTanBin(C MaterialPtr &material);
  384. void setMaterial(int part_i, C MaterialPtr &material);
  385. void drag(Memc<UID> &elms, GuiObj* &focus_obj, C Vec2 &screen_pos);
  386. void drop(Memc<Str> &names, GuiObj *focus_obj, C Vec2 &screen_pos);
  387. void animate(C AnimSkel &anim_skel);
  388. virtual void update(C GuiPC &gpc)override;
  389. static void Add(Str &s, cchar8 *t);
  390. void drawInfo(C GuiPC &gpc);
  391. /////////////////////////////////////////
  392. // MESH
  393. /////////////////////////////////////////
  394. int visibleVariation()C;
  395. int selVariation()C;
  396. void selVariation(int variation, SET_MODE mode=SET_DEFAULT);
  397. int selLod()C;
  398. void selLod(int lod);
  399. void eraseLOD(int i);
  400. void disableLOD(int i);
  401. void updateMesh();
  402. /////////////////////////////////////////
  403. // SLOT
  404. /////////////////////////////////////////
  405. static void SlotModeChanged(ObjView &editor);
  406. static void SlotCopy(ObjView &editor);
  407. static void SlotPaste(ObjView &editor);
  408. static void SlotReplace(ObjView &editor);
  409. void slotRot(flt x, flt y, flt z);
  410. static void SlotRotX (ObjView &editor);
  411. static void SlotRotXN(ObjView &editor);
  412. static void SlotRotY (ObjView &editor);
  413. static void SlotRotYN(ObjView &editor);
  414. static void SlotRotZ (ObjView &editor);
  415. static void SlotRotZN(ObjView &editor);
  416. static void SlotSetSelMirror(ObjView &editor);
  417. static void SlotSetMirrorSel(ObjView &editor);
  418. void slotSetSelMirror(bool set_other);
  419. enum SLOT_MODE
  420. {
  421. SLOT_ADD,
  422. SLOT_DEL,
  423. SLOT_MOVE,
  424. SLOT_ROT,
  425. SLOT_SCALE,
  426. SLOT_RENAME,
  427. SLOT_PARENT,
  428. };
  429. static cchar8 *slot_desc[]
  430. ;
  431. void createSlots();
  432. static void DragSlotsSlot(ptr slot_index, GuiObj *go, C Vec2 &screen_pos);
  433. static void DragSlotsBone(ptr bone_index, GuiObj *go, C Vec2 &screen_pos);
  434. void updateSlots();
  435. void renameSlot(int index, C Str &old_name, C Str &new_name);
  436. void putMeshToSlot(C MeshPtr &mesh, int slot_index);
  437. /////////////////////////////////////////
  438. // BONE
  439. /////////////////////////////////////////
  440. static cchar8 *del_root_bone_dialog_id;
  441. static void DelRootBone(ObjView &editor);
  442. void delRootBone();
  443. void delBone(int bone_i);
  444. static void BoneModeChanged(ObjView &editor); //if(editor.bone_tabs()!=BONE_MOVE && editor.bone_tabs()!=BONE_ROT && editor.bone_tabs()!=BONE_SCALE)editor.selBone(-1);}
  445. static void BoneRootChanged(ObjView &editor);
  446. static void SkelCopy (ObjView &editor);
  447. static void SkelPaste(ObjView &editor);
  448. static void SkelReplace(ObjView &editor);
  449. static void SkelSetSelMirror(ObjView &editor);
  450. static void SkelSetMirrorSel(ObjView &editor);
  451. void skelSetSelMirror(bool set_other);
  452. static void RotBoneRoll(ObjView &editor);
  453. static void AdjustBoneOrnsDo(ObjView &editor);
  454. static void SkelDelBones (ObjView &editor);
  455. void skelDelBones ();
  456. static void SkelDelLeafBones(ObjView &editor);
  457. void skelDelLeafBones();
  458. enum BONE_MODE
  459. {
  460. BONE_ADD,
  461. BONE_DEL,
  462. BONE_MOVE,
  463. BONE_ROT,
  464. BONE_SCALE,
  465. BONE_RENAME,
  466. BONE_PARENT,
  467. };
  468. static cchar8 *bone_desc[]
  469. ;
  470. enum BONE_MOVE_MODE
  471. {
  472. BONE_MOVE_START,
  473. BONE_MOVE_END ,
  474. };
  475. static cchar8 *bone_move_desc[]
  476. ;
  477. enum BONE_CHILDREN_MODE
  478. {
  479. BONE_CHILDREN_NONE ,
  480. BONE_CHILDREN_NEAREST,
  481. BONE_CHILDREN_ALL ,
  482. };
  483. static cchar8 *bone_child_desc[]
  484. ;
  485. static cchar8 *bone_child_rot_desc[]
  486. ;
  487. void clearBones();
  488. void selectLit ();
  489. int boneToVis(int i);
  490. int visToBone(int i);
  491. void selBone(int i);
  492. void createBones();
  493. static void DragBonesBone(ptr bone_index, GuiObj *go, C Vec2 &screen_pos);
  494. void updateBones();
  495. bool renameBone(C Str &old_name, C Str &new_name);
  496. /////////////////////////////////////////
  497. // PHYS
  498. /////////////////////////////////////////
  499. enum PHYS_MODE
  500. {
  501. PHYS_DEL,
  502. PHYS_MOVE,
  503. PHYS_ROT,
  504. PHYS_SCALE,
  505. PHYS_TOGGLE,
  506. };
  507. static cchar8 *phys_desc[]
  508. ;
  509. static void PhysUndo(ObjView &editor);
  510. static void PhysRedo(ObjView &editor);
  511. static void PhysChanged(ObjView &editor);
  512. static void NewBox (ObjView &editor);
  513. static void NewBall (ObjView &editor);
  514. static void NewCapsule(ObjView &editor);
  515. static void NewTube (ObjView &editor);
  516. static void Convex8 (ObjView &editor);
  517. static void Convex16 (ObjView &editor);
  518. static void Convex24 (ObjView &editor);
  519. static void Convex32 (ObjView &editor);
  520. static void Convex64 (ObjView &editor);
  521. static void PhysMesh (ObjView &editor);
  522. static void PhysDel (ObjView &editor);
  523. static void PhysCopy (ObjView &editor);
  524. static Str PhysDensity(C ObjView &editor );
  525. static void PhysDensity( ObjView &editor, C Str &text);
  526. Elm* getPhysElm();
  527. bool hasPhysMeshOrConvex();
  528. void physMesh(MeshBase &mesh);
  529. void physSetConvex(int max_vtxs);
  530. void physSetMesh();
  531. void physCopy();
  532. void physDel();
  533. void createPhys();
  534. void setPhysPartMatrix();
  535. void setPhys(int part);
  536. void updatePhys();
  537. /////////////////////////////////////////
  538. // RAGDOLL
  539. /////////////////////////////////////////
  540. enum RAGDOLL_MODE
  541. {
  542. RAGDOLL_TOGGLE,
  543. RAGDOLL_SCALE ,
  544. RAGDOLL_MOVE ,
  545. };
  546. static cchar8 *ragdoll_desc[]
  547. ;
  548. void createRagdoll();
  549. void updateRagdoll();
  550. public:
  551. ObjView();
  552. };
  553. /******************************************************************************/
  554. /******************************************************************************/
  555. extern ObjView ObjEdit;
  556. /******************************************************************************/