3DCoat Core API
The 3DCoat API documentation.
Loading...
Searching...
No Matches
class_reg.h
1
265#define SERIALIZE() _DEFAULT_NEW; virtual void __COUNTOBJ override
266
297#define SERIALIZE_LATER() _DEFAULT_NEW; virtual void __COUNTOBJ
298
326#define SERIALIZE_NOW(x) void x::__COUNTOBJ
327
356#define FUNCTION_CALL( ...) ARG3_CHOOSER(FUNCTION_CALL1, FUNCTION_CALL2, FUNCTION_CALL3, __VA_ARGS__);
357
380#define LAMBDA_CALL( ...) ARG3_CHOOSER(LAMBDA_CALL1, LAMBDA_CALL2, LAMBDA_CALL3, __VA_ARGS__);
381
401#define ICON_BUTTON( ... ) ARG4_CHOOSER(ICON_BUTTON2, ICON_BUTTON2, ICON_BUTTON3, ICON_BUTTON4, __VA_ARGS__);
402
420#define LAMBDA_ICON_BUTTON( ... ) ARG4_CHOOSER(LAMBDA_ICON_BUTTON2, LAMBDA_ICON_BUTTON2, LAMBDA_ICON_BUTTON3, LAMBDA_ICON_BUTTON4, __VA_ARGS__);
421#define EMPTY_ICON LAMBDA_ICON_BUTTON("empty_square", [] {})
422
445#define STATE_BUTTON(name, variable, value) REG_TYPE_ANYTHING(variable, __state, name, (void*)cPtrDiff(value))
446
470#define REG_AUTO(...) REG_AUTO_MACRO_CHOOSER(__VA_ARGS__)
471
491#define _EACH(bcptr, be) bcptr->ForEach([&](BaseClassElement* __bcelm)->bool { BaseClassElement& be = *__bcelm;
492
498#define _EACH_END __bcelm->reset(false); return false; } );
499
515#define _EACH_FAST_END __bcelm->BC = nullptr; __bcelm->Ptr = nullptr; __bcelm->Visible = __bcelm->Serialize = true; return false; }, true );
516
532#define BCPrintf(...) ((ForEachElem || (result && required_index == 0)) ? comms::cStr::Format(__VA_ARGS__) : comms::cStr::Empty)
533
551#define DELIMITER NOSAVE REG_AUTO_EX(GDLM(), D)
552
591#define REG_DROPLIST(fieldID, name, EnumID) { \
592 static Enumerator* E=ENUM.Get(EnumID);\
593 if(!E)E=ENUM.Create(#EnumID);\
594 REG_TYPE_ANYTHING(fieldID,_index,name,E);\
595}
596
611#define MAKE_ENUMERATOR(name, content) \
612 {\
613 static bool one=true;\
614 if(one){\
615 Enumerator* E=ENUM.Get(name);\
616 StringsList L;\
617 L.Split(content,"|,;\n\r");\
618 for(int i=0;i<L.Count();i++)E->Add(L[i],i);\
619 }\
620 }
621
622
651#define UI_LAYOUT(str) NOSAVE REG_AUTO_ANYTHING(GDLM(),str);
652
682#define UI_ONLY auto_keep_ex(ser,BaseClass::Serialization()); auto_keep_ex(ui,BaseClass::UI_definition()); BaseClass::UI_definition()=true;BaseClass::Serialization()=false;
683
714#define SAVE_ONLY auto_keep_ex(ser,BaseClass::Serialization()); auto_keep_ex(ui,BaseClass::UI_definition()); BaseClass::UI_definition()=false;BaseClass::Serialization()=true;
715
741#define SAVE_OR_UI(save, ui) auto_keep_ex(ser,BaseClass::Serialization()); auto_keep_ex(ui,BaseClass::UI_definition()); BaseClass::UI_definition()=ui;BaseClass::Serialization()=save;
766#define SLIDER(var,name,minvalue,maxvalue) {\
767 static __slider_container tu = GetSliderContainer<decltype(var)>(minvalue, maxvalue);\
768 if(tu.b){\
769 REG_TYPE_GENERAL(var,tu.b,name,tu.p);\
770 }\
771}
772
798#define FSLIDER(var,name,minvalue,maxvalue,VisModulator,Inverse) REG_FSLIDEREX2(var,minvalue,maxvalue,minvalue,VisModulator,Inverse,name)
799
818#define FILEPATH(str, name, mask) REG_TYPE_ANYTHING(str,_cStr,name,(void*)mask);
819
827#define REG_TEXTURE_2(x,y) {const char* s1=#x"";const char* s2=y"";if(s2[0])s1=s2;REG_MEMBER_EX2(_TextureID,x,s1);}
828#define REG_TEXTURE_1(x) REG_TEXTURE_2(x, "")
829#ifdef COMMS_WINDOWS
830#define REG_TEXTURE_MACRO_CHOOSER(...)\
831GET_THIRD_ARG((__VA_ARGS__, REG_TEXTURE_2, REG_TEXTURE_1))(__VA_ARGS__)
832#endif // Windows
833#if defined(COMMS_MACOS) || defined(COMMS_LINUX)
834#define REG_TEXTURE_MACRO_CHOOSER(...)\
835GET_THIRD_ARG(__VA_ARGS__, REG_TEXTURE_2, REG_TEXTURE_1)(__VA_ARGS__)
836#endif // macOS, Linux
837#define REG_TEXTURE(...) REG_TEXTURE_MACRO_CHOOSER(__VA_ARGS__)
838
840#define REG_VECTOR2D(vec) {INVISIBLE REG_MEMBER(_float,vec.x);INVISIBLE REG_MEMBER(_float,vec.y);}
842#define REG_RCT(R) {REG_MEMBER(_float,R.x);REG_MEMBER(_float,R.y);REG_MEMBER(_float,R.w);REG_MEMBER(_float,R.h);}
844#define REG_VECTOR3D(vec) {INVISIBLE REG_MEMBER(_float,vec.x);INVISIBLE REG_MEMBER(_float,vec.y);INVISIBLE REG_MEMBER(_float,vec.z);}
846#define REG_VECTOR4D(vec) {INVISIBLE REG_MEMBER(_float,vec.x);INVISIBLE REG_MEMBER(_float,vec.y);INVISIBLE REG_MEMBER(_float,vec.z);INVISIBLE REG_MEMBER(_float,vec.w);}
848#define REG_MATRIX4D(mat) {for(int i=0;i<4;i++)for(int j=0;j<4;j++){INVISIBLE REG_MEMBER_EX2(_float,mat.Elem(i,j),BCPrintf("%s%d%d",#mat,i,j));}}
850#define REG_MATRIX3D(mat) {for(int i=0;i<3;i++)for(int j=0;j<3;j++){INVISIBLE REG_MEMBER_EX2(_float,mat.Elem(i,j),BCPrintf("%s%d%d",#mat,i,j));}}
851
868#define NOHASH if(!hash)
869
871#define INVISIBLE __FIELD(Visible,false);
873#define READONLY __FIELD(ReadOnly,true);
875#define NOSAVE __FIELD(Serialize,false);
877#define NORESET __FIELD(Noreset,true);
879#define NONAME __FIELD(Noname,true);
881#define RENAME(id) __ADDREG(cStr("[NAME ") + cStr(id) + cStr("]"));
883#define ICON(path) __ADDREG("[ICON "##path##"]");
885#define CHK_GROUP(g) __ADDREG("[GROUP "#g"]");
887#define APPLYSCALE __ADDREG("[APPLYSCALE]");
889#define SKIPHINT __ADDREG("[NOHINT]");
891#define DEFHOTKEY(combo) __ADDREG("[HOTKEY "##combo"]");
893#define LEFTALIGN __ADDREG("[LALIGN]");
895#define SUFFIX(str) __ADDREG("[SUFFIX " str"]");
897#define _COLOR(cc) __ADDREG("[COLOR "#cc"]");
899#define _FONTCOLOR(cc) __ADDREG("[FONTCOLOR "#cc"]");
922#define REG_OPT(x) __ADDREG(x);
923
933#define REG_COORD(x,y,z) \
934 if(swYZ()){\
935 z;\
936 x;\
937 y;\
938 }else{\
939 x;\
940 y;\
941 z;\
942 }
943
957#define _MAKE_ONCE static bool ___LINE_NAME(b) = true; if(___ifonce(___LINE_NAME(b)))
958
970#define DEFINE_SECTION(x) DEFINE_SECTION_SR(x, true, #x)
971
983#define DEFINE_UI_SECTION(x) DEFINE_SECTION_SR(x, false, #x)