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

instancer full copy/deep copy loop rename continuously creates objects #119

Closed
og76 opened this issue Apr 29, 2015 · 5 comments
Closed

instancer full copy/deep copy loop rename continuously creates objects #119

og76 opened this issue Apr 29, 2015 · 5 comments

Comments

@og76
Copy link
Contributor

og76 commented Apr 29, 2015

Just that.
Is trying to make some instances with name001 002 ...00n name9 00n again and again?
use to work, and I did just that renaming a while ago where the instances had only random names

in the blend try to connect the list len to instances to see (and prepare to kill the nodes to stop it ...)
https://drive.google.com/file/d/0BzzAoBwXO8dsa3NFQUlpam5HVXc/view?usp=sharing

@JacquesLucke
Copy link
Owner

The problem here is that the object instancer has to use the object names to identify the objects and if it cannot find the objects it will produce more, and more, and more....
Sorry that I have to say this but there is no real way around the issue you find (as long as the object instancer uses the name)
I can (maybe) create a custom property on objects that belong to the instancer but that would mean to break all existing files and I'm not sure if the ordering of the objects would be consistent.. I don't think so.

@og76
Copy link
Contributor Author

og76 commented May 3, 2015

I guess the quick solution would be to have an extra check for names, as for the random instancexxx names it seams to have no problem. And in this case I don't care for names but I care to have deep copy / separate data. (the simple use case would be for texts with names as the content)
instancer rename1

I don't know how it really works, needing the names, but i'm not sure it is just that. I think I saw names like cube.001 but also cube1.001, so renaming after the new names I was giving? maybe that was just the data, not sure.
what about names already existing? what about manual renaming? I'm not sure and I will further check

@og76
Copy link
Contributor Author

og76 commented May 3, 2015

I can see that above is not a complete solution,as it does recreate the instance, just not forever. Problem being that list is just using plane names. And there are other ways.

so here are two :

  1. Id Blocks, probably the right way to reference blender data,
  2. object groups, simple and works as a list

*1. Create ID Blocks. I can see that such ID Blocks are considered a user of that data and get updated correctly if you change names. They are the appropriate way to reference something in a driver (This may also answer how to not use hard fake user on a tree but actually allow deletion and eventual purge on file close.) May be also used where in the object node the respective obj is not updated if renamed, but if this kind of reference was made it would be...

Another example, but also as alternative list using a type of id block already existent.
I create a keying set and add to it a list of id blocks from various obj. (scene tab) and just use there such reference (no need to add a keyframe on the prop name) and
bpy.data.scenes[0].keying_sets[0].paths[i].id is the resulting thing. a list of objects .. updating right

*2. Use object groups. (tied to the anim node container also?)

there is a thing with obj groups that they actually work as object list. They have an order of the objects in the group, the order they have been added to it or the order of selection if add bunch and with manual renaming it works very well, object still there and does not change the order.
http://blenderscripting.blogspot.ro/2011/05/blender-26-python-grouping-objects.html
I cannot find anything on the net on the very order of the obj in the group, but I know that is for example usable in particle instancing, where you can specify if to dupli all group, objects in order(!) or in random order etc. so it may work as a list

note that the groups are also shown across all scenes and can be referenced across files etc. (so much about naming of the groups now.)

@JacquesLucke
Copy link
Owner

Not that I don't want make this node a bit more advanced and that it cares about renaming etc.. and one of your methods may also work. I'm not sure how experienced you are in programming but maybe you can try your idea out yourself. And see if it works as you expect.

Also I think that you shouldn't care about the names of the outputted objects... If you need more control you should duplicate the objects yourself using shift D or whatever. Then put them into a group and use the group input node. This way you have much more control. The only thing missing from this approach is that you don't have an 'Amount' slider because you have to deal with the amount yourself. Is this possible?

Here are some things the object instancer has to care about:

  • create new objects when the instances amount increases (this is the easiest part)
  • find the needed amount of objects in the current scene
  • remove objects when the instances amount decreases
  • what happens when the user removes an object?
  • what happens when the user renames an object?
  • what happens when the user duplicates objects?
  • what happens when the user remove the instancer node?
  • what happens when the user duplicates the instancer node?
  • what happens when the instancer node is in a loop or group?
  • what should be copied from the original object and what not? (keep in mind the performance, memory and flexibility)

lets say we use your group method: if the user duplicates an object of that group it will be in the group as well, the node will notice that there is an object too much, but how does it decide which one to remove? Same with keying sets I guess

The holy grail would be to have custom properties which reference ID properties, but this isn't possible and propably will never be

@og76
Copy link
Contributor Author

og76 commented May 5, 2015

Thank you for the patience and explanations.

First thing first: my programing skills are 0. Nada. As for scripts, I did scripts for movies, literary kind, ok? Thus, probably some lack of understanding for some things. Yes I may have a technical and mathematical side and I have used quite a bunch of soft for 3d and cad. And I even teached such.
Enough that I can use blender. And animation nodes. An even browse for some script pieces.
And yes, the script node and some expressions, well they can give a wrong impression over me.

Back on topic:
I'm still looking for the fault in the approach over this kind of operation. That is more like modeling. One thing being that an instancer that updates continuously is not needed here. This is more of a one run to create the instances, one loop run to rename. Further updates are useless.
(It is the same in the case of fcurves/key frames. Where those don't need to update all the time. Or the set keyframes node that I used to kinda bake the resulting motion. And that should go just once.)

For this operation, probably separate text is more appropriate. As it has manual refresh. (The actual operation is supposed to create the alphabet as separate objects, for blender font) I will further investigate other ways to do this. I did not use the update settings node yet. Dunno if that is supposed to debug etc or it also has limiting possibilities (like not to refresh..)

on the bug itself:

  1. While this use case is quite marginal, I'd say that the issue remains mostly for the flood of objects that are practically blocking B usage.I see no direct way for not to freeze.
  2. I should not care about the names, but I had to find it the hard way. And others may. So the above.. In certain cases the names may matter, the problem is of the approach.
  3. That is a very interesting problem, the id vs rna. I just tried the group and key sets and there are other places an object is referenced an updated. I keep thinking the animation container is there anyway for instances.

Then again I will explore this id/rna a bit as much as my skills will do. Not for instancer as that is too much. Very probably it is yet another area that is over my head. At least I know that much that there is no special place in the file to store some data, but in a scene or obj or another block like these. And I absolutely support the idea that it should create as few as possible custom things (that don't work in the default BL)

ps. hope not to bother you too much with these long mumblings.

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

No branches or pull requests

2 participants