LightWrap++
AC++wrapperfortheLightWave3DSDK
interface.h
Go to the documentation of this file.
1 #ifndef LWPP_INTERFACE_H
2 #define LWPP_INTERFACE_H
3 
4 #include <lwpp/global.h>
5 
6 // For the schematicPosition function
7 #include <lwpp/point3d.h>
8 
9 // Standard C++ Library includes
10 #include <vector>
11 
12 namespace lwpp
13 {
14  class LWItem; // Forward declaration
15 
25  class InterfaceInfo : protected GlobalBase<LWInterfaceInfo>
26  {
27  private:
28  std::vector<LWItem *> selItems;
29 
30  public:
31  InterfaceInfo( void ) { ; }
32 
33  // CURRENT TIME
35  LWTime currentTime(void)
36  {
37  if (globPtr) return globPtr->curTime;
38  else return 0;
39  }
40 
41  // SELECTED ITEMS
43  // const LWItem selectedItem( void );
44  lwpp::LWItem selectedItem( ) const;
45 
47  std::vector<lwpp::LWItem> selectedItems() const;
48 
49  //ITEM FLAGS
51  unsigned int itemFlags(LWItemID item)
52  {
53  if (globPtr) return globPtr->itemFlags(item);
54  return 0;
55  }
56 
57  // PREVIEW OPTIONS
59  LWFrame previewStart(void)
60  {
61  if (globPtr) return globPtr->previewStart;
62  return 0;
63  }
65  LWFrame previewEnd(void)
66  {
67  if (globPtr) return globPtr->previewEnd;
68  return 0;
69  }
71  LWFrame previewStep(void)
72  {
73  if (globPtr) return globPtr->previewStep;
74  return 0;
75  }
76 
77  // DYNAMIC UPDATE
80  int dynamicUpdate(void)
81  {
82  if (globPtr) return (globPtr->dynaUpdate);
83  return 0;
84  }
86  bool isDynamicUpdateOff(void)
87  {
88  return (dynamicUpdate() & LWDYNUP_OFF);
89  }
92  {
93  return (dynamicUpdate() & LWDYNUP_DELAYED) != 0;
94  }
97  {
98  return (dynamicUpdate() & LWDYNUP_INTERACTIVE)!= 0;
99  }
100 
101  // SCHEMATIC POSITION
104  Point3d schematicPosition(LWItemID item)
105  {
106  if (globPtr)
107  {
108  double x, y;
109  globPtr->schemaPos(item, &x, &y);
110  return Point3d (x,y,0);
111  }
112  return Point3d();
113  }
114 
115  // ITEM DISPLAY
118  int itemVisibility(LWItemID item)
119  {
120  if (globPtr) return globPtr->itemVis(item);
121  return 0;
122  }
124  bool isItemHidden(LWItemID item)
125  {
126  return (itemVisibility(item) & LWOVIS_HIDDEN);
127  }
129  bool isItemBBox(LWItemID item)
130  {
131  return (itemVisibility(item) & LWOVIS_BOUNDINGBOX) !=0;
132  }
134  bool isItemVertices(LWItemID item)
135  {
136  return (itemVisibility(item) & LWOVIS_VERTICES) !=0;
137  }
139  bool isItemWireframe(LWItemID item)
140  {
141  return (itemVisibility(item) & LWOVIS_WIREFRAME) !=0;
142  }
144  bool isItemFrontFace(LWItemID item)
145  {
146  return (itemVisibility(item) & LWOVIS_FFWIREFRAME) !=0;
147  }
149  bool isItemShaded(LWItemID item)
150  {
151  return (itemVisibility(item) & LWOVIS_SHADED) !=0;
152  }
154  bool isItemTextured(LWItemID item)
155  {
156  return (itemVisibility(item) & LWOVIS_TEXTURED) !=0;
157  }
159  bool isItemTexturedShaded(LWItemID item)
160  {
161  return (itemVisibility(item) & LWOVIS_TEXTURED_WIRE) !=0;
162  }
163 
164  // DISPLAY FLAGS
165  unsigned int displayFlags(void)
166  {
167  if (globPtr) return globPtr->displayFlags;
168  return 0;
169  }
172  {
173  return (displayFlags() & LWDISPF_MOTIONPATHS) !=0;
174  }
176  bool isHandlesDisplayed( void )
177  {
178  return (displayFlags() & LWDISPF_HANDLES) !=0;
179  }
181  bool isIKChainsDisplayed( void )
182  {
183  return (displayFlags() & LWDISPF_IKCHAINS) !=0;
184  }
186  bool isCagesDisplayed( void )
187  {
188  return (displayFlags() & LWDISPF_CAGES) !=0;
189  }
191  bool isSafeAreasDisplayed( void )
192  {
193  return (displayFlags() & LWDISPF_SAFEAREAS) !=0;
194  }
197  {
198  return (displayFlags() & LWDISPF_FIELDCHART) !=0;
199  }
200 
201  // GENERAL FLAGS
203  unsigned int generalFlags(void)
204  {
205  if (globPtr) return globPtr->generalFlags;
206  return 0;
207  }
209  bool isToolBarHidden( void )
210  {
211  return (generalFlags() & LWGENF_HIDETOOLBAR) !=0;
212  }
214  bool isToolBarRight( void )
215  {
216  return (generalFlags() & LWGENF_RIGHTTOOLBAR) !=0;
217  }
219  bool isParentInPlace( void )
220  {
221  return (generalFlags() & LWGENF_PARENTINPLACE) !=0;
222  }
224  bool isFractionalFrames( void )
225  {
226  return (generalFlags() & LWGENF_FRACTIONALFRAME) !=0;
227  }
229  bool isKeyFramesVisible( void )
230  {
231  return (generalFlags() & LWGENF_KEYSINSLIDER) !=0;
232  }
234  bool isPlayAtExactRate( void )
235  {
236  return (generalFlags() & LWGENF_PLAYEXACTRATE) !=0;
237  }
239  bool isAutoKeyOn( void )
240  {
241  return (generalFlags() & LWGENF_AUTOKEY) !=0;
242  }
244  bool isIKOn( void )
245  {
246  return (generalFlags() & LWGENF_IKENABLE) !=0;
247  }
249  bool isLMBSelectionOn( void )
250  {
251  return (generalFlags() & LWGENF_LMBITEMSELECT) !=0;
252  }
253 #if (LW_SDK >= 96)
254 
255  bool isDBLClickBoneOn( void )
256  {
257  return (generalFlags() & LWGENF_DOUBLECLICKBONEMODE) !=0;
258  }
260  bool isMotionControllersOn( void )
261  {
262  return (generalFlags() & LWGENF_MCENABLE) !=0;
263  }
264 #endif
265  // BOUNDINGBOX THRESHOLD
268  {
269  if (globPtr) return (globPtr->boxThreshold);
270  return 0;
271  }
272 
273  // ALERT LEVELS
275  int alertLevel(void)
276  {
277  if (globPtr) return globPtr->alertLevel;
278  else return 0;
279  }
281  bool showInfo(void) {return (alertLevel() <= LWALERT_BEGINNER);}
283  bool showWarning(void) {return (alertLevel() <= LWALERT_INTERMEDIATE);}
285  bool showError(void) {return (alertLevel() <= LWALERT_EXPERT);}
286 
287  //AUTO KEY
291  {
292  if (globPtr) return globPtr->autoKeyCreate;
293  return 0;
294  }
297  {
298  return (autoKeyCreate() == LWAKC_OFF);
299  }
302  {
303  return (autoKeyCreate() == LWAKC_MODIFIED);
304  }
307  {
308  return (autoKeyCreate() == LWAKC_ALL);
309  }
310 
311  // ITEM COLORS
313  int itemColor (LWItemID item)
314  {
315  if (globPtr) return globPtr->itemColor(item);
316  else return 0;
317  }
319 
323  void setItemColorIndex(LWItemID item, int color)
324  {
325  if (globPtr) globPtr->setItemColorIndex(item, color);
326  }
328 
332  void setItemColorCustom(LWItemID item, double *color)
333  {
334  if (globPtr) globPtr->setItemColorCustom(item, color);
335  }
336 #if (LW_SDK >= 92)
337 
338 
341  void setObjectsDefaultColor(float color)
342  {
343  if (globPtr) globPtr->defaultItemTypeColor(LWI_OBJECT, &color, 1);
344  }
346 
349  void setLightsDefaultColor(float color)
350  {
351  if (globPtr) globPtr->defaultItemTypeColor(LWI_LIGHT, &color, 1);
352  }
354 
357  void setCamerasDefaultColor(float color[3])
358  {
359  if (globPtr) globPtr->defaultItemTypeColor(LWI_CAMERA, color, 1);
360  }
362 
365  void setBonesDefaultColor(float color[3])
366  {
367  if (globPtr) globPtr->defaultItemTypeColor(LWI_BONE, color, 1);
368  }
370 
373  void getObjectsDefaultColor(float color[3])
374  {
375  if (globPtr) globPtr->defaultItemTypeColor(LWI_OBJECT, color, 0);
376  }
378 
381  void getLightsDefaultColor(float color[3])
382  {
383  if (globPtr) globPtr->defaultItemTypeColor(LWI_LIGHT, color, 0);
384  }
386 
389  void getCamerasDefaultColor(float color[3])
390  {
391  if (globPtr) globPtr->defaultItemTypeColor(LWI_CAMERA, color, 0);
392  }
394 
397  void getBonesDefaultColor(float color[3])
398  {
399  if (globPtr) globPtr->defaultItemTypeColor(LWI_BONE, color, 0);
400  }
401 #if (LW_SDK >= 96)
402  void getItemColour( LWItemID item, unsigned int state, float rgba[4])
403  {
404  if (globPtr) globPtr->itemColorRgba(item, state, rgba);
405  }
406  void getItemColour( LWItemID item, float rgba[4])
407  {
408  getItemColour(item, LWITEMCOL_CURRENT, rgba);
409  }
410 #else
411  void getItemColour( LWItemID item, float rgba[4])
412  {
413  if (globPtr) globPtr->itemColorRgba(item, rgba);
414  }
415 #endif
416 
417 #if (LW_SDK >= 96)
418 
419 
420 
421  void getItemsCurrentColor( LWItemID item, float rgba[4])
422  {
423  if (globPtr) globPtr->itemColorRgba(item, LWITEMCOL_CURRENT, rgba);
424  }
428  void getItemsNormalColor( LWItemID item, float rgba[4])
429  {
430  if (globPtr) globPtr->itemColorRgba(item, LWITEMCOL_NORMAL, rgba);
431  }
435  void getItemsSelectedColor( LWItemID item, float rgba[4])
436  {
437  if (globPtr) globPtr->itemColorRgba(item, LWITEMCOL_SELECTED, rgba);
438  }
439 #endif // LW_SDK 96+
440 
441 
444  float getItemIconScale( LWItemID item)
445  {
446  if (globPtr) return globPtr->itemIconScale(item);
447  return 1.0;
448  }
449 #endif
450  };
451 }
452 
453 #endif
454 
455 // OLD VERSION //
456 //#ifndef LWPP_INTERFACE_H
457 //#define LWPP_INTERFACE_H
458 //
459 //#include <lwpp/global.h>
460 //
461 //namespace lwpp
462 //{
463 //
464 // class LWItem; // Forward declaration
465 //
466 // //! @ingroup Globals
467 // class InterfaceInfo : protected GlobalBase<LWInterfaceInfo>
468 // {
469 // public:
470 // InterfaceInfo( void ) { ; }
471 //
472 // // CURRENT TIME
473 // //! Returns the current time indicated by the frame slider on Layout
474 // LWTime currentTime(void)
475 // {
476 // if (globPtr) return globPtr->curTime;
477 // else return 0;
478 // }
479 //
480 // // SELECTED ITEMS
481 // //! Returns the lwpp::LWItem of the selected Item in Layout, or the first selected item of a multiple selection
482 // void * selectedItem( void );
483 //
484 //
485 // int alertLevel(void)
486 // {
487 // if (globPtr) return globPtr->alertLevel;
488 // else return 0;
489 // }
490 // bool showInfo() {return (alertLevel() <= LWALERT_BEGINNER);}
491 // bool showWarning() {return (alertLevel() <= LWALERT_INTERMEDIATE);}
492 // bool showError() {return (alertLevel() <= LWALERT_EXPERT);}
493 // int itemColor (LWItemID id)
494 // {
495 // return globPtr->itemColor(id);
496 // }
497 // };
498 //
499 //}
500 //
502 //typedef struct st_LWInterfaceInfo {
503 // LWTime curTime;
504 // const LWItemID *selItems;
505 // unsigned int (*itemFlags) (LWItemID);
506 // LWFrame previewStart;
507 // LWFrame previewEnd;
508 // LWFrame previewStep;
509 // int dynaUpdate;
510 // void (*schemaPos) (LWItemID, double *x, double *y);
511 // int (*itemVis) (LWItemID);
512 // unsigned int displayFlags;
513 // unsigned int generalFlags;
514 // int boxThreshold;
515 // int (*itemColor) (LWItemID);
516 // int alertLevel;
517 // int autoKeyCreate;
518 //} LWInterfaceInfo;
519 //*/
520 //
521 //#endif