Comments (13)
Fixed in f0037a7. I should have already done this, but I'll add you to the list of authors. Do you want to go by Steffen or MinnieTheMoocher? 😉
from ldr-importer.
the latter, please. it's my github identity.
from ldr-importer.
your f0037a7 corrects the unofficial/official files search order, but the error with the p/8 folder is still in it.
it needs to be treated like this
paths = []
paths.append(file_directory)
paths.append(os.path.join(LDrawDir, "models"))
paths.append(os.path.join(LDrawDir, "unofficial", "parts"))
if HighRes:
paths.append(os.path.join(LDrawDir, "unofficial", "p", "48"))
elif LowRes:
paths.append(os.path.join(LDrawDir, "unofficial", "p", "8"))
paths.append(os.path.join(LDrawDir, "unofficial", "p"))
paths.append(os.path.join(LDrawDir, "parts"))
if HighRes:
paths.append(os.path.join(LDrawDir, "p", "48"))
elif LowRes:
paths.append(os.path.join(LDrawDir, "p", "8"))
paths.append(os.path.join(LDrawDir, "p"))
I.e.,
"When the HighRes flag is set to true, let the p/48 folder take precedence.
ELSE
When the LowRes flag is set to true, let the p/8 folder take precedence.
ELSE
Fallback to the p/ folder
"
from ldr-importer.
There is no LowRes
variable (unless you are referring to #44), so it would actually be elif not HighRes
.
Is this the proper formatting? Python uses indentation levels for if/elif/else
. In this, parts/
and p/
are always searched no matter the value of HighRes
. Do I need to move those under elif not HighRes
as well? There really is no else
in this section.
paths = []
paths.append(file_directory)
paths.append(os.path.join(LDrawDir, "models"))
paths.append(os.path.join(LDrawDir, "unofficial", "parts"))
if HighRes:
paths.append(os.path.join(LDrawDir, "unofficial", "p", "48"))
elif not HighRes:
paths.append(os.path.join(LDrawDir, "unofficial", "p", "8"))
paths.append(os.path.join(LDrawDir, "unofficial", "p"))
paths.append(os.path.join(LDrawDir, "parts"))
if HighRes:
paths.append(os.path.join(LDrawDir, "p", "48"))
elif not HighRes:
paths.append(os.path.join(LDrawDir, "p", "8"))
paths.append(os.path.join(LDrawDir, "p"))
from ldr-importer.
no, "elif not HighRes" would be equal to "else" which is wrong here!:
the p/8 folder must ONLY be used if the user explicitly requests so.
the current implementation is wrong, because it always uses that folder if HighRes is NOT enabled,
which is wrong.
the fix is very simple!
just introduce a flag "LogRes" completely analogous to "HighRes", i.e., change
highResPrims = BoolProperty(
name="Use High-Res Primitives",
description="Replace all Primitives by Hi-Res (48ed) Primitives",
default=False
)
to
highResPrims = BoolProperty(
name="Use High-Res Primitives",
description="Replace all Primitives by Hi-Res (48ed) Primitives",
default=False
)
lowResPrims = BoolProperty(
name="Use Low-Res Primitives",
description="Replace all Primitives by Lo-Res (8ed) Primitives",
default=False
)
and
box.prop(self, "highResPrims", icon="MOD_BUILD")
to
box.prop(self, "highResPrims", icon="MOD_BUILD")
box.prop(self, "lowResPrims", icon="MOD_BUILD")
and
global LDrawDir, CleanUp, GameFix, HighRes, CleanUpOpt
LDrawDir = str(self.ldrawPath)
HighRes = bool(self.highResPrims)
to
global LDrawDir, CleanUp, GameFix, HighRes, LowRes, CleanUpOpt
LDrawDir = str(self.ldrawPath)
HighRes = bool(self.highResPrims)
LowRes = bool(self.lowResPrims)
and
if HighRes:
debugPrint("High resolution bricks option selected")
to
if HighRes:
debugPrint("High resolution bricks option selected")
if LowRes:
debugPrint("Low resolution bricks option selected")
from ldr-importer.
in a future refacturing, you can merge these 2 boolean flags to a simple multiple choice:
- do no primtives replacement (default)
- always use High-Res primitives (this currently is the flag "HighRes")
- always use Low-Res primitives (this currently is the flag "LowRes")
from ldr-importer.
to make is simple, here is the corrected file (untested):
https://gist.github.com/MinnieTheMoocher/d337bb86864befd094b8
from ldr-importer.
Yikes the formatting. You might want to paste that in a Gist and edit your comment with the link.
from ldr-importer.
here it is :)
from ldr-importer.
I tested the patch and it works. However, I did edit it to make the options exclusive so both are not used (and clean up the options a bit) and to work better with your last patch. The layout looks like this now.
You can review the changes (and the descriptions) on the highres-or-lowres
branch.
from ldr-importer.
What about "normal-res" primitives? All you have is low and high.
from ldr-importer.
I didn't show that option in the screenshots. ;)
from ldr-importer.
Fixed by #54, issue solved!
from ldr-importer.
Related Issues (20)
- Install errors on OS X with version 1, 3, 0 HOT 5
- Missing LDraw Search Path on Linux HOT 2
- problem: 'cannot find c:/Ldraw' HOT 3
- ldr-importer does not import all lego blocks HOT 19
- Can't install 1.3.1 HOT 3
- Incorrect Normals / Broken Normals with some random parts/bricks HOT 2
- Unexpected normals when cleanup disabled HOT 1
- Model file contents too short to extract header HOT 7
- 1.3.2 doesn't work - back to 1.2.0 HOT 4
- Using LDR-Importer from python API HOT 2
- "Basic Cleanup" function corrupts LEGO logo in open studs HOT 3
- FBX export is not supporting Cycles nodes HOT 1
- Problem: cannot find Ldraw installation at c:\ HOT 1
- Path's reset of LDraw Parts Library
- Cannot Find LDraw Installation at C:/Ldraw HOT 4
- Doesn't load model
- LDD to LDR, missing pieces, moved pieces HOT 1
- LDD-Importer-Exporter for the future HOT 1
- I can't use this addon
- Traceback call issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ldr-importer.