Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

[Discussion] Script Rewrite for v2.0 #35

Closed
le717 opened this issue Dec 9, 2013 · 24 comments
Closed

[Discussion] Script Rewrite for v2.0 #35

le717 opened this issue Dec 9, 2013 · 24 comments

Comments

@le717
Copy link
Owner

le717 commented Dec 9, 2013

Quote @Banbury

Also the recursive constructor is probably not a good idea.
This looks like a major rewrite is necessary. Fun :(.

And quote @tribex

Okay, I think this entire thing needs to be redone. Period.
If only I could understand it enough to get all the recursion right.

Currently the structure appears to be:

  1. Create a new object - >
  2. Parse the main file, then all sub files, and append to the sub file list - >
  3. go through the subfile list and create a new object for each subpart - > Step 1

It really needs to use functions, not while recursions, lists, and objects.

As it has been established, the script needs a rewrite very badly. I think it needs to be done ASAP to not only fix any bugs present but to also make any new development much easier. Yes, it is Christmas time so we won't have too much time to work on it right now, but release milestones do not have deadlines until after they are released, so there is not a huge rush. By doing it now rather, we will have less new code to salvage and features to restore from the old version.

I know we already have issues assigned to v1.2 v2.0, but I propose to push these back to v1.3, and let v1.2 v2.0 be the rewrite. We would not have to add new features, a rewrite should be enough to warrant a new release (and it may overall be faster when it is all said and done).

We can work out all the details later (I've enabled the wiki for us to put the plan on), but I propose Banbury take the lead (as he identified the need for a rewrite), and by lead I mean lay out the new script structure and guidelines we should implement and follow. Obviously this is a team project so ideas/concerns can be expressed and added, but we still need someone to oversee the operations.:wink:

We would more than likely make a branch off master (I'll call it rewrite in this issue) to hold the new changes. If it is possible (and I know it is), we'll branch off that branch to work on our our assignments, and those would be merged back into rewrite. When the script is complete, rewrite will be merged back into master.

Like I said, all details can be worked out, This is simply a proposition to proceed with the rewrite before too many new features (such as implementing the Cycles LEGO Materials @rioforce actually created for us) are added, making it harder to redo.

Are there any questions, concerns, comments or something I need to clarify? Do you think we should go ahead with this?

@JoshTheDerf
Copy link
Collaborator

Sounds like a good idea! I'd much rather have Banbury lead, as I still can't quite wrap my head around this thing. (Python's lack of static types can actually be a pain at times)

@Banbury
Copy link
Collaborator

Banbury commented Dec 11, 2013

I have no plans to rewrite the importer for the time being, since it works well enough for me. Currently I'm playing with the new 2D features of Unity3D.
If you want to rewrite it, I'll be happy to help by reviewing the code and testing. But you'll have to do the main part of the work.

As a starting point I would suggest to move the parsing of the DAT files into its own class. The data could be stored in a dictionary. A second class would then take this dictionary and build a model from it. That would make the whole thing much easier to read. The whole material stuff could also have its own class. The script is already getting rather large. So splitting it into multiple files would also be a good idea.

@JoshTheDerf
Copy link
Collaborator

Well in that case, I'll try doing what you said as soon as I get a few more core features implemented in https://github.com/Tribex/RapidS

@le717
Copy link
Owner Author

le717 commented Dec 20, 2013

Alright, sounds like a plan! Banbury, will you make a diagram of what you suggested on the wiki? That will help us when we are coding. 😉

That's fine, Tribex. I probably won't start working on it this week either (Christmas is this week after all), but I will go ahead and make the branch for the changes and update the aforementioned issues for the v1.3 milestone.

@Banbury
Copy link
Collaborator

Banbury commented Dec 21, 2013

Umm, no? I don't want to be a dick here, but drawing diagrams is what I'm doing at work and currently I'm on vacation.

@JoshTheDerf
Copy link
Collaborator

@le717 I'll attempt to make a diagram, if I can understand it. Just finished the last major thing for RapidS 0.1. (Documentation) >_>

Where is the wiki document? I can probably find it.

@le717
Copy link
Owner Author

le717 commented Dec 22, 2013

@Banbury No no, I understand. I wouldn't want to do what I do every day for work on vacation either. It's all good. 😉

@tribex Right under the pull request button at the right of the page is a book icon. That is the wiki. It can also be accessed from https://github.com/le717/LDR-Importer/wiki. Put it somewhere under Developer Area.

The script is already getting rather large. So splitting it into multiple files would also be a good idea.

Good idea, but not completely possible. Blender has a requirement that all addons have an bl_info dictionary, and without one it throws (harmless, but possibly scary) error messages. In addition, they have no directive or way to get around this requirement. Blender itself has to be changed to allow this. Yes, it would ideally be broken up into multiple scripts, but we simply can't (and because all addons must be in the root addons folder, and will not detect them in subfolders, requiring yet another Blender change. >_<).

@JoshTheDerf
Copy link
Collaborator

@le717 I'll try to come up with a good system/diagram, currently down with a cold.

We could do multiple files the same way as we do the configuration. With fake includes.

@Banbury
Copy link
Collaborator

Banbury commented Dec 22, 2013

It's perfectly possible to split the script into multiple files and/or packages. The Blender way to do this is to move the bl_info into the _init.py.
Please see here how to create a package in Python. You can also have a look at the addons in Blender (/2.69/scripts/addons) for examples.

@Banbury
Copy link
Collaborator

Banbury commented Dec 22, 2013

Before I forget. Please create a new branch for the rewrite. This will be a lot of work and maybe we still want to do fixes for the old version, before the new version is ready.

@le717
Copy link
Owner Author

le717 commented Dec 23, 2013

New branch already created. I had already thought of that when I created the issue. ;)

https://github.com/le717/LDR-Importer/tree/rewrite

:O Looks like I have some reading to do! Thanks! Although loading from sub folders would still be nice...

@tribex Oh no! D: Hope you feel better soon!

Merry Christmas, everyone. 😃

@JoshTheDerf
Copy link
Collaborator

Thanks :)

Merry Christmas! :D

@JoshTheDerf
Copy link
Collaborator

An example of why this is needed is in #39

@le717
Copy link
Owner Author

le717 commented Dec 28, 2013

Don't worry Tribex, we have already firmly established reasons for the rewrite. 😉 I may have time to work on it soon, but we need that diagram first so we know how to proceed.

@JoshTheDerf
Copy link
Collaborator

RIght, but how do we make a diagram if we don't know how to proceed? I have a few ideas, but they're not very solid yet.

@le717
Copy link
Owner Author

le717 commented Dec 28, 2013

Quote Banbury:

As a starting point I would suggest to move the parsing of the DAT files into its own class. The data could be stored in a dictionary. A second class would then take this dictionary and build a model from it. That would make the whole thing much easier to read. The whole material stuff could also have its own class. The script is already getting rather large. So splitting it into multiple files would also be a good idea.

Banbury, you want to add to this?

@JoshTheDerf
Copy link
Collaborator

Ah, okay. I'll hopefuly start this afternoon... Depending on how late I'm actually out.

@Banbury
Copy link
Collaborator

Banbury commented Dec 28, 2013

If I would do the rewrite, I would start by writing a generic LDraw parser class, that stores the whole model in some Python structure (either a dictionary or a class tree). Then I'd write a class that reads this data structure and creates a model from it. Basic enough. The devil is of course in the details 😄.

PS: I'm currently preparing the release of a Unity 3D addon. So I'm rather occupied right now.

@JoshTheDerf
Copy link
Collaborator

What does the addon do?

Also, no diagram today... And my schedule is unfortunately getting much busier for the foreseeable future. :C

@Banbury
Copy link
Collaborator

Banbury commented Dec 28, 2013

http://vimeo.com/82824100
https://github.com/Banbury/UnitySpritesAndBones

I'm not finished uploading yet. Any discussion should happen there.

@JoshTheDerf
Copy link
Collaborator

What exactly does that do to Unity? Make your desktop literally 3D?

BTW, vimeo is blocked in my country.

@Banbury
Copy link
Collaborator

Banbury commented Dec 28, 2013

I'm talking about Unity 3D, the game engine.

@JoshTheDerf
Copy link
Collaborator

Oh sorry, I thought you meant the Ubuntu Unity 3D.

@le717 le717 mentioned this issue Jan 16, 2014
9 tasks
@le717
Copy link
Owner Author

le717 commented Jan 20, 2014

Simply making a note here.
@Anonymooseable just introduced me to this:

http://www.blender.org/documentation/blender_python_api_2_69_9/bpy.types.AddonPreferences.html

We might be able to use this for the preferences system instead.

@le717 le717 closed this as completed Aug 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants