Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new node input single vertex #90

Merged
merged 2 commits into from
Dec 24, 2019
Merged

new node input single vertex #90

merged 2 commits into from
Dec 24, 2019

Conversation

zebus3d
Copy link
Contributor

@zebus3d zebus3d commented Dec 23, 2019

I created the node to create a single vertex :)

Copy link
Owner

@aachman98 aachman98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I actually already had reviewed this file when you sent it on email. Added a couple of optional changes just for the sake of uniformity though. Change it if you want, and let me know so that I can merge this to master.

bl_idname = "ScSingleVertex"
bl_label = "Single Vertex"

def init(self, context):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to override method.

def init(self, context):
super().init(context)

def error_condition(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

name = self.inputs["Name"].default_value
me = bpy.data.meshes.new(name + "_mesh")
obj = bpy.data.objects.new(name, me)
obj.location = bpy.context.scene.cursor.location
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the object at 0,0,0 instead of cursor location
Can be later changed using "Set Transform" if required

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the object at 0,0,0 instead of cursor location
Can be later changed using "Set Transform" if required

I could check that when creating any object with the sorcar nodes, the behavior is that it is created where you have the cursor. To have a greater consistent with the other nodes, I thought it was a good idea to make it behave like the other nodes.

Copy link
Owner

@aachman98 aachman98 Dec 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I forgot that primitives are added on the cursor...

@aachman98
Copy link
Owner

What about the other implementation: Adding a plane & merging at center?

@zebus3d
Copy link
Contributor Author

zebus3d commented Dec 24, 2019

What about the other implementation: Adding a plane & merging at center?

It was a quick initial implementation. Keep in mind that creating a plane (two triangles) and then collapsing them to obtain a single vertex, are more steps and is more expensive than creating the vertex directly. In a simple scene it can be the same if you use one or the other, but in very heavy scenes you will be grateful to optimize the computation avoiding unnecessary intermediate processes.

@aachman98 aachman98 merged commit 42b96ed into aachman98:master Dec 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants