Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 25
Posts: 25   Pages: 3   [ Previous Page | 1 2 3 ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 10744 times and has 24 replies Next Thread
sjb007
Advanced Member




Joined: May 18, 2021
Post Count: 210
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

@Daniels118 Oh, and if you could look at the java changes and tell me all the Java conventions I blew through, I'd appreciate it.
[Jun 22, 2022, 2:57:00 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 398
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

Sorry for late response. I looked at the changes and they seems ok, but you know it's up to Emmanuel to decide wether to merge or not into the main stream.
If you decide to make it a plugin you could consider to override the OBJWriter instead of duplicate the whole code. This is how I managed to obtain this result for another project I'm working on:
public class LDObjWriter extends OBJWriter {
private boolean firstNode = true;
private boolean separateObjects = false;

public boolean isSeparateObjects() {
return separateObjects;
}

public void setSeparateObjects(boolean separateObjects) {
this.separateObjects = separateObjects;
}

@Override
public void writeNode(Node node) throws IOException, InterruptedIOException {
writeNode(node, null);
}

@Override
public void writeNode(Node node, String nodeName) throws IOException, InterruptedIOException {
if (firstNode) {
super.writeNode(null, null);
firstNode = false;
}
if (separateObjects && nodeName != null && !nodeName.isEmpty()) {
this.out.write("o " + nodeName + "\n");
}
super.writeNode(node, nodeName);
}

public void newObject(String name) throws IOException {
if (firstNode) {
super.writeNode(null, null);
firstNode = false;
}
this.out.write("o " + name + "\n");
separateObjects = false;
}
}

[Jul 9, 2022, 5:55:57 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Keet
Advanced Member
Member's Avatar

Netherlands
Joined: Apr 8, 2022
Post Count: 753
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

Last week I discovered the usefulness of the o line in an obj file. I had to bisect a complex set of objects and I couldn't do that because all of the g groups and no o object. So I added the line manually and it still didn't work until I flagged all g lines as remarks. That gave a single object in Blender but of course had the disadvantage of no more g groups.

Rereading the posts in this thread I went looking for the gear to change settings when importing and after I switched of groups just the o line was enough to allow selection of a single object, which I needed for bisecting and still retain the g groups.

Big vote here to add o line(s) to the obj export. I manage to create very complex furniture with just SH3D but there a few things it can't do that sometimes are needed.
[Jul 9, 2022, 7:00:57 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
sjb007
Advanced Member




Joined: May 18, 2021
Post Count: 210
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

@Daniels118 "Resurrectus threadius!"

I've picked this back up, got Eclipse installed, done the plugin tutorial, and have a vague idea how I can turn this into a plugin.

As I said <points at self> clueless Javamateur. I had a look at a couple of plugins, and I see yours looking all purty! You have a bunch of the boilerplate stuff all squared away. Can I ask your permission to shamelessly and liberally borrow that stuff and adapt it for my needs? It will save me a ton of time scratching my head that can be better spent getting the meat of the plugin to work.
[Dec 11, 2022, 7:33:09 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Daniels118
Advanced Member
Member's Avatar

Italy
Joined: Nov 17, 2021
Post Count: 398
Status: Offline
Reply to this Post  Reply with Quote 
Re: Add "o" to OBJWriter output

Hi Stephen, all my plugins are licensed under GPL, so you are free to reuse all the code as long as you respect the terms (keep it open source, under GPL, and cite the author).
[Dec 12, 2022, 9:01:58 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 25   Pages: 3   [ Previous Page | 1 2 3 ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved