Reality Composer: How to replace object without losing behaviours? - augmented-reality

I have a 3D model which I'm setting up for AR using Reality Composer on a Mac. I've assigned a few basic behaviours to the model. For example, making certain objects spin when tapped.
The problem: I will need to make changes to the model based on client requests. When I make the changes and import the new model into Reality Composer the behaviours seem to be "unlinked". I'm hoping there's a way to import an updated model without having to set up the behaviours every time.
I'm new to Reality Composer so I might be missing something obvious.
I tried using the built-in "replace" option in the right-click menu. This does replace the model, but not without breaking the behaviours.

Related

How do libraries interact with other code?

I've been reading about encapsulation and keep seeing comments about how changing the privacy of a class or adding getters and setters where there were none before can 'break the code' of people who use your library. I don't really understand this. I'm very inexperienced in programming, and my understanding is that you download a library onto your computer and it's included in the files of the program you're writing, so if the original author changed something in THEIR COPY of the library, it wouldn't affect your copy. Is this wrong? For example, is a library more like a website that your computer connects to through the internet and the original author can update, so that changes they make to it can affect how your code works?
Software is constantly changing, so we must have a way to keep track of the different versions - hence software versions. When you download a library to use in your own program, you (usually, like with a dependency management tool) end up downloading a very specific version of that library.
If a library author was to change the interface to use it, developers using that library would also have to change how they use it when they download the version with those changes. Otherwise, it would break any code that follows an outdated interface.
As long as a library author follows proper versioning procedures, for instance including breaking changes in a new major version, and the changes improve the clarity of the library's interfaces without sacrificing other properties, then the argument is moot. Developers can either continue using the old version or update their code to be compatible with the new version.
Except for maybe in low resource, embedded systems that can use all optimizations available, like accessing object/structure properties directly rather than through a function.
Libraries:
By definition a collection of non-volatile resources used by computer
programs, often for software development. These may include
configuration data, documentation, help data, message templates,
pre-written code and subroutines, classes, values or type
specifications.
Explanation
Let me spend time on defining in coding aspects: Lets say you have a
create a soccer game, what does that need, field, ball, players,
flags.
All this we encapsulate in Class to make as Object Game which
comprises all above.
Now you start building game and realise you are spending redudant time making repeated player names, shirt design , details filling, etc.
To avoid this you make functions which are business specific like 1. generate tshirts and pass (color, design , cloth type) and it returnes you tshirt object in return.
Similary you get player information by passing country and his ID and all this details are return as Player object which have his name, place, country, contacts ets.
This is how the functions in class behaves.
Your ask
privacy of a class or adding getters and setters, ...an 'break the code' of people who use your library
These are ways how you access the object parameters or set values for them , in some languages the getter and setters are auto generated and not required to explicitly set unless you need custom settings during class object creation.
The best advantage of the getting and setter is it ensures the default class creation can be assigned some values which you dont want to change in defaults and also not allow people to enforce new values to that specific parameter of class.
This is how the control is made in place during defining your class and its functions. getter and setter are functions as well with class variables having factility to get/set values as you define the function logic inside.
You ask
my understanding is that you download a library onto your computer and
it's included in the files of the program you're writing, so if the
original author changed something in THEIR COPY of the library, it
wouldn't affect your copy. Is this wrong?
Yes think it like a CD Copy , I sent you a copy so you can use those info from the copy i made, but once i have new features and things added in CompactDisc(CD) it wouldnt be there in your copy i burnt during that time hence you code uses the old version and may use till there is need to update.
You can only get impacted if you take my new CD copy which is called as upgrading your software with my new library version.
Normally big guys software dont immediately change the library in their systems unless there is thorough analysis done with 1. need, 2. security 3. bugs in old fixed in new. factors to address for a new upgrade.
Happy Coding
Software world is free of your mind to code so dont think what is wrong or right just code.
Take a Maths Library building task in hand use anything python, java, c#, objective C, swift, javascript ...
Create library with modules with Circle, Square, Polygon, Sphere objects
Each object they will have thier respective Classes created with theier paramters (circle sample : radius, center(x,y), etc and functions like setRadius, getCircumference, etc)
Similar way all objects makes thier own classes
Abstrat word you used means some function you make private that only class can internally access but not exposed to outside when you create new Maths Object.
Hope this was helpful, happy coding.

Extend rails model in engine

I am creating a Rails engine to augment a host app specifically to aid in development. For example, the engine will have a UI that will allow you to toggle features on or off in the host app so that dev's can see how the app performs in either case.
Originally I intended to extend the models from the parent application inside of the engine but I have not been able to find a straightforward way to do this.
I understand that generally speaking, this approach tightly couples the two applications so it's not necessarily ideal, but in my instance coupling is acceptable as the engine is only for developing this particular application.
I have looked at creating decorators inside of the engine and including them into the parent - I don't love the idea in particular because the decorators are meant only for dev purposes and I don't want anything included going to production.
I am open to suggestions as to the best approach. Any ideas?
Thanks.
EDIT - Adding Clarity...
We have a legacy app that can be difficult to reason about. Often times a combination of values across tables/fields work together to determine if a feature is enabled and how it will behave. The idea was to create an engine that functions specifically to help new and existing team members understand that a given feature is on (or turn it on) without having to know what combination of fields to look at or toggle in the db.
As an extension of this idea, let's say that I want to show in the UI that feature X is enabled. Feature X is enabled if model.foo is true and model.bar is false. Rather than have to have template logic that says if model.foo is true and model.bar is false then feature X is on, I'd like to be able to define a method that says if model.feature_x_enabled? then feature X is enabled.
I could just put this logic in the application model but it will only be used by the engine for now and adding this type of thing in wont make the app itself any easier to understand. So I wanted to find a good encapsulation for this inside of the engine.
I hope that make more sense.

Dependencies between Features

We're having our first attempt at writing some Gherkin specs for a greenfield application and I'm not sure how to tackle what appear to be inter-dependant features.
Essentially, we have a feature CreateADoor that is actually used as part of two other features BuildAHouse and BuildAShed.
The CreateADoor feature is relatively complex in terms of validation etc. which is why we have lifted it out as a seperate feature (to avoid duplication). The issue is that the result of scenarios for this feature are dependant on the context they were called from (should my newly built door be on a House or a Shed).
The only way I can really see to solve this is to get rid of CreateADoor and have its scenarios duplicated inside both BuildAHouse and BuildAShed. In this specific situation this would be (just about) bearable, but what about the situation where CreateADoor requires 10 scenarios to spec it out, and is used by 10 different features. Having 10 scenarios explode out into 100 doesn't seem good, but I can't see another option at the minute.
Can anyone suggest a different approach that allows us to avoid this explosion of scenarios?
Ideally you should not create these dependencies, but instead if creating a door is part of building a house then the building a house feature should create a door as part of its setup instead of reusing the feature to test creating a door.
This might look like this:
Given I have created a house door
When I create a house
Then I should be able to live in it
and the logic for creating the door should be in the code behind the Given step. This logic might be very different from what actually happens when you create a door in the tests.
If you can't separate things like this then one thing I have done in the past is to make the code behind the Given step call the other steps from the CreateADoor feature so that the code is not duplicated, but the existing steps are reused. This is not ideal, but pragmatically this is sometimes necessary.

xcode update class after modifying data model

Is there an automatic way using XCode5, to update the class definitions after modifying the core data model (of course I'm talking about the classes regarding the data model ;) ).
I checked here, but the solution was not satisfying and since xcode 5 is out, maybe there is something new.
Thnaks
I normally implement all my custom code of managed object subclasses in categories. This is already part of my normal workflow and counts as an established best practice.
Now regenerating your class definitions is nothing more than choosing one menu command. I think this is an acceptable degree of automation.
Beats any third party framework import, learning curve and maintenance.

Does Model-View-Controller Play Nicely with Artificial Intelligence and Behavior Trees?

I come from an MVC background (Flex and Rails) and love the ideas of code separation, reusability, encapsulation, etc. It makes it easy to build things quickly and reuse components in other projects. However, it has been very difficult to stick with the MVC principles when trying to build complex, state-driven, asynchronous, animated applications.
I am trying to create animated transitions between many nested views in an application, and it got me thinking about whether or not I was misleading myself... Can you apply principles from MVC to principles from Artificial Intelligence (Behavior-Trees, Hierarchical State Machines, Nested States), like Games? Do those two disciplines play nicely together?
It's very easy to keep the views/graphics ignorant of anything outside of themselves when things are static, like with an HTML CMS system or whatever. But when you start adding complex state-driven transitions, it seems like everything needs to know about everything else, and the MVC almost gets in the way. What do you think?
Update:
An example. Well right now I am working on a website in Flex. I have come to the conclusion that in order to properly animate every nested element in the application, I have to think of them as AI Agents. Each "View", then, has it's own Behavior Tree. That is, it performs an action (shows and hides itself) based on the context (what the selected data is, etc.). In order to do that, I need a ViewController type thing, I'm calling it a Presenter. So I have a View (the graphics laid out in MXML), a Presenter (defining the animations and actions the View can take based on the state and nested states of the application), and a Presentation Model to present the data to the View (through the presenter). I also have Models for value objects and Controllers for handling URLs and database calls etc... all the normal static/html-like MVC stuff.
For a while there I was trying to figure out how to structure these "agents" such that they could respond to their surrounding context (what's selected, etc.). It seemed like everything needed to be aware of everything else. And then I read about a Path/Navigation Table/List for games and immediately thought they have a centrally-stored table of all precalculated actions every agent can take. So that got me wondering how they actually structure their code.
All of the 3D video game stuff is a big secret, and a lot of it from what I see is done with a graphical UI/editor, like defining behavior trees. So I'm wondering if they use some sort of MVC to structure how their agents respond to the environment, and how they keep their code modular and encapsulated.
"Can you apply principles from MVC to
principles from Artificial
Intelligence (Behavior-Trees,
Hierarchical State Machines, Nested
States), like Games?"
Of course. 99.9% of the AI is purely in the Model. The Controller sends the inputs to it, the View is how you represent it on the screen to the user.
Now, if you want to start having the AI control something, you may end up nesting the concepts, and your game 'model' contains a Model for an entity, a Controller for the entity which is the AI sending commands to it, and a View for the entity which represents the perceptions of that entity that the Controller can work with. But that's a separate issue from whether it can 'play nicely'. MVC is about separating presentation and input from logic and state and that aspect doesn't care what the logic and state looks like.
Keep this in mind:
The things which need to react simply have to be aware of the things to which they need to react.
So if they need to know about everything, then they need to know about everything.
Otherwise, -how- do you make them aware? In 3D video games stuff, say first-person shooters, the enemies react to sound and sight (footsteps / gunshots and you / dead bodies, for instance). Note that I indicated an abstract basis, and parts of the decision tree.
It might be wrong in your specific case to separate the whole thing between several agents, and simpler to leave it to one main agent who can delegate orders to separate processes (/begin babble) : each view could be a process which could be told to switch to any (a number of) view by the main agent, depending on what data the main agent has received.
Hope that helps.. Take it all with a grain of salt :)
It sounds like you need to make more use of the Observer/Event Aggregator pattern. If multiple components need to react to arbitrary application events without introducing undue coupling, then using an event aggregator would help you out. Example: when an item is selected, an application event is published, relevant controllers tell their view to run animations, etc. Different components aren't aware of others, they just listen for common events.
Also, the code that makes the view do things (launch animation depending on model/controller state) - that's part of the View itself, so you don't have to make your architecture weird by having a controller and a viewcontroller. If it's UI specific code, then it's part of the view. I'm not familiar with Flex, but in WPF/Silverlight, stuff like that would go into the code-behind (though for the most part Visual State Manager is more than enough to deal with state animations so you can keep everything in XAML).

Resources