LDCad 1.6 Beta 1 (win+linux)


RE: LDCad 1.6 Beta 1 (win+linux)
#44
(2017-01-30, 8:21)Milan Vančura Wrote: * object "snap object" accessible from scripts and visible (like after pressing F11) and selectable by user. To be able to write a script making triangles without asking the user for adding extra axles etc. Also for setting the part rotation point etc.

You are right this is to big a change for 1.6, but i'm in the mid of adding basic snap info access. However now I'm thinking it might be completely useless without a way to choose the actual wanted one.

For example the simple 2x4 birck has 16 snap info objects. Being able to access those 16 data points might be handy for some others things though.



Currently I'm working on this (the luaCB_* functions will become available inside lua without the luaCB_ prefix).

Code:
 class TLuaSnapInfo : public TLuaUserData {
   private:
     typedef TLuaUserData inherited;

     static const int posOriCore(lua_State *luaState, const bool doPos, const bool doOri); //override

   protected:
     virtual void boolParamIO(bool &value, const int index, const bool doGet, TLuaWrapper *lua); //override
     virtual void strParamIO(TString &value, const int index, const bool doGet, TLuaWrapper *lua); //override

   public:
     TLuaSnapInfo() : inherited() {}

     static const char *ldcSubModName;
     static const char *luaTypeName;
     static const luaL_Reg subModFuncs[];
     static const luaL_Reg objFuncs[];
     static void ldcLibReg(lua_State *luaState) { basic_ldcLibReg(luaState, ldcSubModName, subModFuncs, luaTypeName, objFuncs); }

     static int luaCB_gc(lua_State *luaState) { return basic_gc(luaState, luaTypeName); }
     static int luaCB_toString(lua_State *luaState) { return basic_toString(luaState, luaTypeName); }

     static int luaCB_new(lua_State *luaState);
     static int luaCB_clone(lua_State *luaState) { return basic_clone(luaState, luaTypeName); };

     static int luaCB_isCYL(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 0, true); }
     static int luaCB_isCLP(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 1, true); }
     static int luaCB_isFGR(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 2, true); }
     static int luaCB_isGEN(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 3, true); }

     static int luaCB_getID(lua_State *luaState) { return singleStrParamIO(luaState, luaTypeName, 0, true); }
     static int luaCB_getGroup(lua_State *luaState) { return singleStrParamIO(luaState, luaTypeName, 1, true); }

     static int luaCB_isMale(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 4, true); }
     static int luaCB_isFemale(lua_State *luaState) { return singleBoolParamIO(luaState, luaTypeName, 5, true); }

     static int luaCB_getPosOri(lua_State *luaState) { return posOriCore(luaState, true, true); }
     static int luaCB_getPos(lua_State *luaState) { return posOriCore(luaState, true, false); }
     static int luaCB_getOri(lua_State *luaState) { return posOriCore(luaState, false, true); }

     virtual TLuaUserData *clone() const { return new TLuaSnapInfo(*this); } //override
     virtual const char *getLuaTypeName() const { return luaTypeName; } //override
 };

So do you think it's worth including anyway?
Any idea on additional stuff needed to make this usable?
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: LDCad 1.6 Beta 1 (win+linux) - by TestOne - 2016-12-28, 15:33
RE: LDCad 1.6 Beta 1 (win+linux) - by TestOne - 2016-12-28, 21:49
RE: LDCad 1.6 Beta 1 (win+linux) - by Roland Melkert - 2017-02-03, 21:18

Forum Jump:


Users browsing this thread: 1 Guest(s)