Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
igl::anttweakbar::ReTwBar Class Reference

#include <src/libigl/igl/anttweakbar/ReAntTweakBar.h>

+ Collaboration diagram for igl::anttweakbar::ReTwBar:

Public Member Functions

IGL_INLINE ReTwBar ()
 
IGL_INLINE void TwNewBar (const char *_name)
 
IGL_INLINE int TwAddVarRW (const char *name, TwType type, void *var, const char *def, const bool record=true)
 
IGL_INLINE int TwAddVarCB (const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def, const bool record=true)
 
IGL_INLINE int TwAddVarRO (const char *name, TwType type, void *var, const char *def)
 
IGL_INLINE int TwAddButton (const char *name, TwButtonCallback buttonCallback, void *clientData, const char *def)
 
IGL_INLINE int TwSetParam (const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues)
 
IGL_INLINE int TwGetParam (const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues)
 
IGL_INLINE int TwRefreshBar ()
 
IGL_INLINE int TwTerminate ()
 
IGL_INLINE bool save (const char *file_name)
 
std::string get_value_as_string (void *var, TwType type)
 
IGL_INLINE bool load (const char *file_name)
 
IGL_INLINE bool type_from_string (const char *type_str, TwType &type)
 
IGL_INLINE bool set_value_from_string (const char *name, TwType type, const char *value_str)
 
IGL_INLINE const std::vector< ReTwRWItem > & get_rw_items ()
 
IGL_INLINE const std::vector< ReTwCBItem > & get_cb_items ()
 

Public Attributes

TwBar * bar
 
std::string name
 

Protected Attributes

std::vector< ReTwRWItemrw_items
 
std::vector< ReTwCBItemcb_items
 

Private Member Functions

IGL_INLINE ReTwBar (const ReTwBar &that)
 
IGL_INLINE ReTwBaroperator= (const ReTwBar &that)
 

Detailed Description

Constructor & Destructor Documentation

◆ ReTwBar() [1/2]

IGL_INLINE igl::anttweakbar::ReTwBar::ReTwBar ( )
131 :
132 bar(NULL),
133 name(),
135{
136}
std::string name
Definition ReAntTweakBar.h:167
std::vector< ReTwRWItem > rw_items
Definition ReAntTweakBar.h:169
TwBar * bar
Definition ReAntTweakBar.h:166
std::vector< ReTwCBItem > cb_items
Definition ReAntTweakBar.h:170

◆ ReTwBar() [2/2]

IGL_INLINE igl::anttweakbar::ReTwBar::ReTwBar ( const ReTwBar that)
private
139 :
140 bar(that.bar),
141 name(that.name),
142 rw_items(that.rw_items),
143 cb_items(that.cb_items)
144{
145}

Member Function Documentation

◆ get_cb_items()

IGL_INLINE const std::vector< igl::anttweakbar::ReTwCBItem > & igl::anttweakbar::ReTwBar::get_cb_items ( )
932{
933 return cb_items;
934}

Referenced by igl::xml::load_ReAntTweakBar(), and igl::xml::save_ReAntTweakBar().

+ Here is the caller graph for this function:

◆ get_rw_items()

IGL_INLINE const std::vector< igl::anttweakbar::ReTwRWItem > & igl::anttweakbar::ReTwBar::get_rw_items ( )
926{
927 return rw_items;
928}

Referenced by igl::xml::load_ReAntTweakBar(), and igl::xml::save_ReAntTweakBar().

+ Here is the caller graph for this function:

◆ get_value_as_string()

IGL_INLINE std::string igl::anttweakbar::ReTwBar::get_value_as_string ( void var,
TwType  type 
)
350{
351 std::stringstream sstr;
352 switch(type)
353 {
354 case TW_TYPE_BOOLCPP:
355 {
356 sstr << "TW_TYPE_BOOLCPP" << " ";
357 sstr << *(static_cast<bool*>(var));
358 break;
359 }
360 case TW_TYPE_QUAT4D:
361 {
362 sstr << "TW_TYPE_QUAT4D" << " ";
363 // Q: Why does casting to double* work? shouldn't I have to cast to
364 // double**?
365 double * q = static_cast<double*>(var);
366 sstr << std::setprecision(15) << q[0] << " " << q[1] << " " << q[2] << " " << q[3];
367 break;
368 }
369 case TW_TYPE_QUAT4F:
370 {
371 sstr << "TW_TYPE_QUAT4F" << " ";
372 // Q: Why does casting to float* work? shouldn't I have to cast to
373 // float**?
374 float * q = static_cast<float*>(var);
375 sstr << q[0] << " " << q[1] << " " << q[2] << " " << q[3];
376 break;
377 }
378 case TW_TYPE_COLOR4F:
379 {
380 sstr << "TW_TYPE_COLOR4F" << " ";
381 float * c = static_cast<float*>(var);
382 sstr << c[0] << " " << c[1] << " " << c[2] << " " << c[3];
383 break;
384 }
385 case TW_TYPE_COLOR3F:
386 {
387 sstr << "TW_TYPE_COLOR3F" << " ";
388 float * c = static_cast<float*>(var);
389 sstr << c[0] << " " << c[1] << " " << c[2];
390 break;
391 }
392 case TW_TYPE_DIR3D:
393 {
394 sstr << "TW_TYPE_DIR3D" << " ";
395 double * d = static_cast<double*>(var);
396 sstr << std::setprecision(15) << d[0] << " " << d[1] << " " << d[2];
397 break;
398 }
399 case TW_TYPE_DIR3F:
400 {
401 sstr << "TW_TYPE_DIR3F" << " ";
402 float * d = static_cast<float*>(var);
403 sstr << d[0] << " " << d[1] << " " << d[2];
404 break;
405 }
406 case TW_TYPE_BOOL32:
407 {
408 sstr << "TW_TYPE_BOOL32" << " ";
409 sstr << *(static_cast<int*>(var));
410 break;
411 }
412 case TW_TYPE_UINT8:
413 {
414 sstr << "TW_TYPE_UINT8" << " ";
415 // Cast to int so that it's human readable
416 sstr << (int)*(static_cast<unsigned char*>(var));
417 break;
418 }
419 case TW_TYPE_INT32:
420 {
421 sstr << "TW_TYPE_INT32" << " ";
422 sstr << *(static_cast<int*>(var));
423 break;
424 }
425 case TW_TYPE_UINT32:
426 {
427 sstr << "TW_TYPE_UINT32" << " ";
428 sstr << *(static_cast<unsigned int*>(var));
429 break;
430 }
431 case TW_TYPE_FLOAT:
432 {
433 sstr << "TW_TYPE_FLOAT" << " ";
434 sstr << *(static_cast<float*>(var));
435 break;
436 }
437 case TW_TYPE_DOUBLE:
438 {
439 sstr << "TW_TYPE_DOUBLE" << " ";
440 sstr << std::setprecision(15) << *(static_cast<double*>(var));
441 break;
442 }
443 case TW_TYPE_STDSTRING:
444 {
445 sstr << "TW_TYPE_STDSTRING" << " ";
446 std::string *destPtr = static_cast<std::string *>(var);
447 sstr << destPtr->c_str();
448 break;
449 }
450 default:
451 {
452 using namespace std;
453 std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::const_iterator iter =
454 ReTw_custom_types.find(type);
455 if(iter != ReTw_custom_types.end())
456 {
457 sstr << (*iter).second.first << " ";
458 int enum_val = *(static_cast<int*>(var));
459 // try find display name for enum value
460 std::vector<TwEnumVal>::const_iterator eit = (*iter).second.second.begin();
461 bool found = false;
462 for(;eit<(*iter).second.second.end();eit++)
463 {
464 if(enum_val == eit->Value)
465 {
466 sstr << eit->Label;
467 found = true;
468 break;
469 }
470 }
471 if(!found)
472 {
473 sstr << "ERROR_ENUM_VALUE_NOT_DEFINED";
474 }
475 }else
476 {
477 sstr << "ERROR_TYPE_NOT_SUPPORTED";
478 }
479 break;
480 }
481 }
482 return sstr.str();
483}
std::string var(const std::string &file_name)
Definition utils.cpp:154
std::map< TwType, std::pair< const char *, std::vector< TwEnumVal > > > ReTw_custom_types
Definition ReAntTweakBar.cpp:22
STL namespace.

Referenced by igl::xml::save_ReAntTweakBar().

+ Here is the caller graph for this function:

◆ load()

IGL_INLINE bool igl::anttweakbar::ReTwBar::load ( const char *  file_name)
486{
487 FILE * fp;
488 fp = fopen(file_name,"r");
489
490 if(fp == NULL)
491 {
492 printf("ERROR: not able to open %s for reading...\n",file_name);
493 return false;
494 }
495
496 // go through file line by line
497 char line[REANTTWEAKBAR_MAX_LINE];
498 bool still_comments;
500 char type_str[REANTTWEAKBAR_MAX_WORD];
501 char value_str[REANTTWEAKBAR_MAX_WORD];
502
503
504 // line number
505 int j = 0;
506 bool finished = false;
507 while(true)
508 {
509 // Eat comments
510 still_comments = true;
511 while(still_comments)
512 {
513 if(fgets(line,REANTTWEAKBAR_MAX_LINE,fp) == NULL)
514 {
515 finished = true;
516 break;
517 }
518 // Blank lines and lines that begin with # are comments
519 still_comments = (line[0] == '#' || line[0] == '\n');
520 j++;
521 }
522 if(finished)
523 {
524 break;
525 }
526
527 sscanf(line,"%[^:]: %s %[^\n]",name,type_str,value_str);
528 //printf("%s: %s %s\n",name, type_str,value_str);
529
530 TwType type;
531 if(!type_from_string(type_str,type))
532 {
533 printf("ERROR: %s type not found... Skipping...\n",type_str);
534 continue;
535 }
536 set_value_from_string(name,type,value_str);
537
538 }
539
540 fclose(fp);
541
542 // everything succeeded
543 return true;
544}
#define REANTTWEAKBAR_MAX_LINE
Definition ReAntTweakBar.h:58
#define REANTTWEAKBAR_MAX_WORD
Definition ReAntTweakBar.h:59
IGL_INLINE bool set_value_from_string(const char *name, TwType type, const char *value_str)
Definition ReAntTweakBar.cpp:576
IGL_INLINE bool type_from_string(const char *type_str, TwType &type)
Definition ReAntTweakBar.cpp:546

References REANTTWEAKBAR_MAX_LINE, and REANTTWEAKBAR_MAX_WORD.

◆ operator=()

IGL_INLINE igl::anttweakbar::ReTwBar & igl::anttweakbar::ReTwBar::operator= ( const ReTwBar that)
private
149{
150 // check for self assignment
151 if(this != &that)
152 {
153 bar = that.bar;
154 rw_items = that.rw_items;
155 cb_items = that.cb_items;
156 }
157 return *this;
158}

References bar, cb_items, and rw_items.

◆ save()

IGL_INLINE bool igl::anttweakbar::ReTwBar::save ( const char *  file_name)
285{
286 FILE * fp;
287 if(file_name == NULL)
288 {
289 fp = stdout;
290 }else
291 {
292 fp = fopen(file_name,"w");
293 }
294
295 if(fp == NULL)
296 {
297 printf("ERROR: not able to open %s for writing...\n",file_name);
298 return false;
299 }
300
301 // Print all RW variables
302 for(
303 std::vector<ReTwRWItem>::iterator it = rw_items.begin();
304 it != rw_items.end();
305 it++)
306 {
307 std::string s = (*it).name;
308 const char * name = s.c_str();
309 TwType type = (*it).type;
310 void * var = (*it).var;
311 fprintf(fp,"%s: %s\n",
312 name,
313 get_value_as_string(var,type).c_str());
314 }
315
317 // Print all CB variables
318 for(
319 std::vector<ReTwCBItem>::iterator it = cb_items.begin();
320 it != cb_items.end();
321 it++)
322 {
323 const char * name = it->name.c_str();
324 TwType type = it->type;
325 //TwSetVarCallback setCallback = it->setCallback;
326 TwGetVarCallback getCallback = it->getCallback;
327 void * clientData = it->clientData;
328 // I'm not sure how to do what I want to do. getCallback needs to be sure
329 // that it can write to var. So var needs to point to a valid and big
330 // enough chunk of memory
331 getCallback(var,clientData);
332 fprintf(fp,"%s: %s\n",
333 name,
334 get_value_as_string(var,type).c_str());
335 }
336
337 fprintf(fp,"\n");
338
339 if(file_name != NULL)
340 {
341 fclose(fp);
342 }
343 // everything succeeded
344 return true;
345}
#define REANTTWEAKBAR_MAX_CB_VAR_SIZE
Definition ReAntTweakBar.h:56
std::string get_value_as_string(void *var, TwType type)
Definition ReAntTweakBar.cpp:347

References REANTTWEAKBAR_MAX_CB_VAR_SIZE.

◆ set_value_from_string()

bool igl::anttweakbar::ReTwBar::set_value_from_string ( const char *  name,
TwType  type,
const char *  value_str 
)
580{
581 void * value = NULL;
582 // possible value slots
583 int i;
584 float v;
585 double dv;
586 float f[4];
587 double d[4];
588 bool b;
589 unsigned int u;
590 unsigned char uc;
591 std::string s;
592
593 // First try to get value from default types
594 switch(type)
595 {
596 case TW_TYPE_BOOLCPP:
597 {
598 int ib;
599 if(sscanf(value_str," %d",&ib) == 1)
600 {
601 b = ib!=0;
602 value = &b;
603 }else
604 {
605 printf("ERROR: Bad value format...\n");
606 return false;
607 }
608 break;
609 }
610 case TW_TYPE_QUAT4D:
611 //case TW_TYPE_COLOR4D:
612 {
613 if(sscanf(value_str," %lf %lf %lf %lf",&d[0],&d[1],&d[2],&d[3]) == 4)
614 {
615 value = &d;
616 }else
617 {
618 printf("ERROR: Bad value format...\n");
619 return false;
620 }
621 break;
622 }
623 case TW_TYPE_QUAT4F:
624 case TW_TYPE_COLOR4F:
625 {
626 if(sscanf(value_str," %f %f %f %f",&f[0],&f[1],&f[2],&f[3]) == 4)
627 {
628 value = &f;
629 }else
630 {
631 printf("ERROR: Bad value format...\n");
632 return false;
633 }
634 break;
635 }
636 //case TW_TYPE_COLOR3D:
637 case TW_TYPE_DIR3D:
638 {
639 if(sscanf(value_str," %lf %lf %lf",&d[0],&d[1],&d[2]) == 3)
640 {
641 value = &d;
642 }else
643 {
644 printf("ERROR: Bad value format...\n");
645 return false;
646 }
647 break;
648 }
649 case TW_TYPE_COLOR3F:
650 case TW_TYPE_DIR3F:
651 {
652 if(sscanf(value_str," %f %f %f",&f[0],&f[1],&f[2]) == 3)
653 {
654 value = &f;
655 }else
656 {
657 printf("ERROR: Bad value format...\n");
658 return false;
659 }
660 break;
661 }
662 case TW_TYPE_UINT8:
663 {
664 if(sscanf(value_str," %d",&i) == 1)
665 {
666 // Cast to unsigned char
667 uc = (unsigned char) i;
668 value = &uc;
669 }else
670 {
671 printf("ERROR: Bad value format...\n");
672 return false;
673 }
674 break;
675 }
676 case TW_TYPE_BOOL32:
677 case TW_TYPE_INT32:
678 {
679 if(sscanf(value_str," %d",&i) == 1)
680 {
681 value = &i;
682 }else
683 {
684 printf("ERROR: Bad value format...\n");
685 return false;
686 }
687 break;
688 }
689 case TW_TYPE_UINT32:
690 {
691 if(sscanf(value_str," %u",&u) == 1)
692 {
693 value = &u;
694 }else
695 {
696 printf("ERROR: Bad value format...\n");
697 return false;
698 }
699 break;
700 }
701 case TW_TYPE_FLOAT:
702 {
703 if(sscanf(value_str," %f",&v) == 1)
704 {
705 value = &v;
706 }else
707 {
708 printf("ERROR: Bad value format...\n");
709 return false;
710 }
711 break;
712 }
713 case TW_TYPE_DOUBLE:
714 {
715 if(sscanf(value_str," %lf",&dv) == 1)
716 {
717 value = &dv;
718 }else
719 {
720 printf("ERROR: Bad value format...\n");
721 return false;
722 }
723 break;
724 }
725 case TW_TYPE_STDSTRING:
726 {
727 s = value_str;
728 value = &s;
729 break;
730 }
731 default:
732 // Try to find type in custom enum types
733 std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::const_iterator iter =
734 ReTw_custom_types.find(type);
735 if(iter != ReTw_custom_types.end())
736 {
737 std::vector<TwEnumVal>::const_iterator eit = (*iter).second.second.begin();
738 bool found = false;
739 for(;eit<(*iter).second.second.end();eit++)
740 {
741 if(strcmp(value_str,eit->Label) == 0)
742 {
743 i = eit->Value;
744 value = &i;
745 found = true;
746 break;
747 }
748 }
749 if(!found)
750 {
751 printf("ERROR_ENUM_VALUE_NOT_DEFINED");
752 }
753 }else
754 {
755 printf("ERROR_TYPE_NOT_SUPPORTED\n");
756 }
757
758 break;
759 }
760
761
762 // Find variable based on name
763 // First look in RW items
764 bool item_found = false;
765 for(
766 std::vector<ReTwRWItem>::iterator it = rw_items.begin();
767 it != rw_items.end();
768 it++)
769 {
770 if(it->name == name)
771 {
772 void * var = it->var;
773 switch(type)
774 {
775 case TW_TYPE_BOOLCPP:
776 {
777 bool * bvar = static_cast<bool*>(var);
778 bool * bvalue = static_cast<bool*>(value);
779 *bvar = *bvalue;
780 break;
781 }
782 case TW_TYPE_QUAT4D:
783 //case TW_TYPE_COLOR4D:
784 {
785 double * dvar = static_cast<double*>(var);
786 double * dvalue = static_cast<double*>(value);
787 dvar[0] = dvalue[0];
788 dvar[1] = dvalue[1];
789 dvar[2] = dvalue[2];
790 dvar[3] = dvalue[3];
791 break;
792 }
793 case TW_TYPE_QUAT4F:
794 case TW_TYPE_COLOR4F:
795 {
796 float * fvar = static_cast<float*>(var);
797 float * fvalue = static_cast<float*>(value);
798 fvar[0] = fvalue[0];
799 fvar[1] = fvalue[1];
800 fvar[2] = fvalue[2];
801 fvar[3] = fvalue[3];
802 break;
803 }
804 //case TW_TYPE_COLOR3D:
805 case TW_TYPE_DIR3D:
806 {
807 double * dvar = static_cast<double*>(var);
808 double * dvalue = static_cast<double*>(value);
809 dvar[0] = dvalue[0];
810 dvar[1] = dvalue[1];
811 dvar[2] = dvalue[2];
812 break;
813 }
814 case TW_TYPE_COLOR3F:
815 case TW_TYPE_DIR3F:
816 {
817 float * fvar = static_cast<float*>(var);
818 float * fvalue = static_cast<float*>(value);
819 fvar[0] = fvalue[0];
820 fvar[1] = fvalue[1];
821 fvar[2] = fvalue[2];
822 break;
823 }
824 case TW_TYPE_UINT8:
825 {
826 unsigned char * ucvar = static_cast<unsigned char*>(var);
827 unsigned char * ucvalue = static_cast<unsigned char*>(value);
828 *ucvar = *ucvalue;
829 break;
830 }
831 case TW_TYPE_BOOL32:
832 case TW_TYPE_INT32:
833 {
834 int * ivar = static_cast<int*>(var);
835 int * ivalue = static_cast<int*>(value);
836 *ivar = *ivalue;
837 break;
838 }
839 case TW_TYPE_UINT32:
840 {
841 unsigned int * uvar = static_cast<unsigned int*>(var);
842 unsigned int * uvalue = static_cast<unsigned int*>(value);
843 *uvar = *uvalue;
844 break;
845 }
846 case TW_TYPE_FLOAT:
847 {
848 float * fvar = static_cast<float*>(var);
849 float * fvalue = static_cast<float*>(value);
850 *fvar = *fvalue;
851 break;
852 }
853 case TW_TYPE_DOUBLE:
854 {
855 double * dvar = static_cast<double*>(var);
856 double * fvalue = static_cast<double*>(value);
857 *dvar = *fvalue;
858 break;
859 }
860 case TW_TYPE_STDSTRING:
861 {
862 std::string * svar = static_cast<std::string*>(var);
863 std::string * svalue = static_cast<std::string*>(value);
864 *svar = *svalue;
865 break;
866 }
867 default:
868 // Try to find type in custom enum types
869 std::map<TwType,std::pair<const char *,std::vector<TwEnumVal> > >::iterator iter =
870 ReTw_custom_types.find(type);
871 if(iter != ReTw_custom_types.end())
872 {
873 int * ivar = static_cast<int*>(var);
874 std::vector<TwEnumVal>::iterator eit = (*iter).second.second.begin();
875 bool found = false;
876 for(;eit<(*iter).second.second.end();eit++)
877 {
878 if(strcmp(value_str,eit->Label) == 0)
879 {
880 *ivar = eit->Value;
881 found = true;
882 break;
883 }
884 }
885 if(!found)
886 {
887 printf("ERROR_ENUM_VALUE_NOT_DEFINED");
888 }
889 }else
890 {
891 printf("ERROR_TYPE_NOT_SUPPORTED\n");
892 }
893 break;
894 }
895 item_found = true;
896 break;
897 }
898 }
899
900 // Try looking in CB items
901 if(!item_found)
902 {
903 for(
904 std::vector<ReTwCBItem>::iterator it = cb_items.begin();
905 it != cb_items.end();
906 it++)
907 {
908 if(it->name==name)
909 {
910 it->setCallback(value,it->clientData);
911 item_found = true;
912 break;
913 }
914 }
915 }
916
917 if(!item_found)
918 {
919 printf("ERROR: item '%s' not found\n",name);
920 }
921 return true;
922}

Referenced by igl::xml::load_ReAntTweakBar().

+ Here is the caller graph for this function:

◆ TwAddButton()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddButton ( const char *  name,
TwButtonCallback  buttonCallback,
void clientData,
const char *  def 
)
225{
226 int ret =
227 ::TwAddButton(this->bar,name,buttonCallback,clientData,def);
228 // buttons are not recorded
229 //if(ret)
230 //{
231 // cb_items.push_back(ReTwCBItem(name,type,setCallback,getCallback,clientData));
232 //}
233 return ret;
234}
IGL_INLINE int TwAddButton(const char *name, TwButtonCallback buttonCallback, void *clientData, const char *def)
Definition ReAntTweakBar.cpp:220

◆ TwAddVarCB()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarCB ( const char *  name,
TwType  type,
TwSetVarCallback  setCallback,
TwGetVarCallback  getCallback,
void clientData,
const char *  def,
const bool  record = true 
)
195{
196 int ret =
197 ::TwAddVarCB(this->bar,name,type,setCallback,getCallback,clientData,def);
198 if(ret && record)
199 {
200 cb_items.push_back(ReTwCBItem(name,type,setCallback,getCallback,clientData));
201 }
202 return ret;
203}
IGL_INLINE int TwAddVarCB(const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def, const bool record=true)
Definition ReAntTweakBar.cpp:187

◆ TwAddVarRO()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarRO ( const char *  name,
TwType  type,
void var,
const char *  def 
)
210{
211 int ret = ::TwAddVarRO(this->bar,name,type,var,def);
212 // Read only variables are not recorded
213 //if(ret)
214 //{
215 // rw_items.push_back(ReTwRWItem(name,type,var));
216 //}
217 return ret;
218}
IGL_INLINE int TwAddVarRO(const char *name, TwType type, void *var, const char *def)
Definition ReAntTweakBar.cpp:205

◆ TwAddVarRW()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwAddVarRW ( const char *  name,
TwType  type,
void var,
const char *  def,
const bool  record = true 
)
178{
179 int ret = ::TwAddVarRW(this->bar,name,type,var,def);
180 if(ret && record)
181 {
182 rw_items.push_back(ReTwRWItem(name,type,var));
183 }
184 return ret;
185}
IGL_INLINE int TwAddVarRW(const char *name, TwType type, void *var, const char *def, const bool record=true)
Definition ReAntTweakBar.cpp:172

◆ TwGetParam()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwGetParam ( const char *  varName,
const char *  paramName,
TwParamValueType  paramValueType,
unsigned int  outValueMaxCount,
void outValues 
)
260{
261 return
262 ::TwGetParam(
263 this->bar,
264 varName,
265 paramName,
266 paramValueType,
267 outValueMaxCount,
268 outValues);
269}

◆ TwNewBar()

IGL_INLINE void igl::anttweakbar::ReTwBar::TwNewBar ( const char *  _name)
163{
164 this->bar = ::TwNewBar(_name);
165 // Alec: This causes trouble (not sure why) in multiple applications
166 // (medit, puppet) Probably there is some sort of memory corrpution.
167 // this->name = _name;
168 // Suspiciously this also fails:
169 //this->name = "foobar";
170}
IGL_INLINE void TwNewBar(const char *_name)
Definition ReAntTweakBar.cpp:162

◆ TwRefreshBar()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwRefreshBar ( )
272{
273 return ::TwRefreshBar(this->bar);
274}

◆ TwSetParam()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwSetParam ( const char *  varName,
const char *  paramName,
TwParamValueType  paramValueType,
unsigned int  inValueCount,
const void inValues 
)
242{
243 // For now just pass these along
244 return
245 ::TwSetParam(
246 this->bar,
247 varName,
248 paramName,
249 paramValueType,
250 inValueCount,
251 inValues);
252}

◆ TwTerminate()

IGL_INLINE int igl::anttweakbar::ReTwBar::TwTerminate ( )
277{
278 //std::cout<<"TwTerminate"<<std::endl;
279 int r = ::TwTerminate();
280 //std::cout<<" "<<r<<std::endl;
281 return r;
282}
IGL_INLINE int TwTerminate()
Definition ReAntTweakBar.cpp:276

◆ type_from_string()

IGL_INLINE bool igl::anttweakbar::ReTwBar::type_from_string ( const char *  type_str,
TwType &  type 
)
548{
549 // first check default types
550 for(int j = 0; j < RETW_NUM_DEFAULT_TYPE_STRINGS; j++)
551 {
552 if(strcmp(type_str,ReTwDefaultTypeStrings[j].type_str) == 0)
553 {
555 return true;
556 break;
557 }
558 }
559
560 // then check custom types
561 std::map<
562 TwType,std::pair<const char *,std::vector<TwEnumVal> >
563 >::const_iterator iter =
564 ReTw_custom_types.begin();
565 for(;iter != ReTw_custom_types.end(); iter++)
566 {
567 if(strcmp((*iter).second.first,type_str)==0)
568 {
569 type = (*iter).first;
570 return true;
571 }
572 }
573 return false;
574}
#define RETW_NUM_DEFAULT_TYPE_STRINGS
Definition ReAntTweakBar.cpp:102
TwType type
Definition ReAntTweakBar.cpp:98
ReTwTypeString ReTwDefaultTypeStrings[RETW_NUM_DEFAULT_TYPE_STRINGS]
Definition ReAntTweakBar.cpp:103

References RETW_NUM_DEFAULT_TYPE_STRINGS, and anonymous_namespace{ReAntTweakBar.cpp}::ReTwTypeString::type.

Referenced by igl::xml::load_ReAntTweakBar().

+ Here is the caller graph for this function:

Member Data Documentation

◆ bar

TwBar* igl::anttweakbar::ReTwBar::bar

◆ cb_items

std::vector<ReTwCBItem> igl::anttweakbar::ReTwBar::cb_items
protected

Referenced by operator=().

◆ name

std::string igl::anttweakbar::ReTwBar::name

◆ rw_items

std::vector<ReTwRWItem> igl::anttweakbar::ReTwBar::rw_items
protected

Referenced by operator=().


The documentation for this class was generated from the following files: