← Back to team overview

kicad-developers team mailing list archive

Re: question re: KiFace and Prj()

 

On 11/2/2015 4:58 PM, Cirilo Bernardo wrote:
> On Tue, Nov 3, 2015 at 3:59 AM, Wayne Stambaugh <stambaughw@xxxxxxxxx
> <mailto:stambaughw@xxxxxxxxx>> wrote:
> 
>     Prj() is always available for any kiway application.  See
>     http://ci.kicad-pcb.org/job/kicad-doxygen/ws/Documentation/doxygen/html/classKIWAY.html
> 
>     I would rather not make any code directly dependent on Prj() other than
>     the main editing windows.  Please consider passing any necessary
>     information stored in Prj() to you objects.  I'm not sure what you need
>     to store in the Prj() object that is required to load 3D objects.
> 
> 
> The object I need to pass around is the 3D model equivalent of the
> FP_LIB_TABLE object
> so I thought Prj() would be the most convenient place to put it.
> Alternatively I can make it a
> single global but it must be notified when the project working directory
> changes.

This is exactly why fp-lib-table does not live inside the .pro file.
Putting the project library table into the .pro file is not portable and
it adds the Prj() dependency to the fp-lib-table code which I did not
feel was a good design decision.  You should consider a similar approach
for defining 3D model libraries.  Take a look at fpid.h/cpp and
fp_lib_table.h/cpp.  Feel free to borrow ideas from them.  The nice
thing about the fp-lib-table approach is that it is flexible in how
users configure their libraries.  The Prj() method has it's limitations.
 You can be assured that the new schematic component library format
implementation will look remarkably like the fp-lib-table
implementation.  I hope I can reuse most of this code.  I may have to
refactor out the common code to a generic lib-table class but either way
it will be very similar in design.

> 
> The specific problem I have at the moment has to do with
> 3d-viewer/3d_class.cpp;
> in S3D_MASTER::SetShape3DName the m_Shape3DFullFilename is determined,
> so I need access to the 3D Model Manager which I put into Prj(). This is
> something of
> a stop-gap measure since Mario is working on replacing the rendering
> system and we
> plan to make the large and complex S3D_MASTER object disappear so that
> MODULE
> will only hold pointers to an extremely simple structure which only
> contains a filename,
> offset, rotation, and scale. That would essentially remove all
> information which MODULE
> really isn't responsible for and the 3d cache will take responsibility
> for holding and
> managing the 3D data.
> 
> Is there any current method for a class like S3D_MASTER to obtain a
> pointer/reference
> to a KIWAY or Prj()?

You would have to pass the pointer to the Pjr() to you S3D_MASTER and
use it accordingly.

> 
> - Cirilo
> 
>  
> 
>     On 10/24/2015 3:21 AM, Cirilo Bernardo wrote:
>     > The accessibility of  Prj() is a mystery to me.  I would like to
>     access
>     > Prj() from various places,
>     > for example 3d_class.cpp but I have no idea how to do this (or if
>     it's a
>     > good idea at all).
>     > I'd appreciate any tips.  What I'd like to do really is make the 3D
>     > Cache Manager and its
>     > subparts available to various components of 3d-viewer so that I
>     can have
>     > an improved
>     > filename resolution scheme in place as part of the 3D refactor work.
>     >
>     > - Cirilo
>     >
>     >
>     >
>     > _______________________________________________
>     > Mailing list: https://launchpad.net/~kicad-developers
>     > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     > Unsubscribe : https://launchpad.net/~kicad-developers
>     > More help   : https://help.launchpad.net/ListHelp
>     >
> 
>     _______________________________________________
>     Mailing list: https://launchpad.net/~kicad-developers
>     Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>     <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
>     Unsubscribe : https://launchpad.net/~kicad-developers
>     More help   : https://help.launchpad.net/ListHelp
> 
> 



References